Re: Grep For Line Containing 1or 2 Words

From: noi (noi_at_siam.com)
Date: 01/25/05


Date: Tue, 25 Jan 2005 22:40:59 GMT

On Tue, 25 Jan 2005 16:47:23 -0500, Buck Turgidson thoughtfully wrote:

> Looking for help in writing a grep (or perl) that will pull from a text
> file those lines containing one or two "words". I want to reject any line
> that contains more than 2 words (a sentence).
>
> Appreciate any help from text processing experts.

Would this work for you? (Assumed text file)
$ cat file | grep -v --regexp=" " > nospaces