Re: Grep For Line Containing 1or 2 Words

From: Andrew Schulman (andrex_at_deadspam.com)
Date: 01/27/05


Date: Thu, 27 Jan 2005 12:10:56 -0500


> 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).

grep -v '[^ ]+ +[^ ]+ +[^ ]+'

Not pretty, but that's grep for you.

-- 
To reply by email, replace "deadspam.com" by "alumni.utexas.net"


Relevant Pages