Re: Grep For Line Containing 1or 2 Words
From: drwxr-xr-x (bit-bucket_at_config.com)
Date: 01/30/05
- Next message: Tom Rauschenbach: "Suse cron vs. Slackware cron"
- Previous message: Mark Healey: "udev and Kyocera 7135 smart phone."
- In reply to: noi: "Re: Grep For Line Containing 1or 2 Words"
- Next in thread: noi: "Re: Grep For Line Containing 1or 2 Words"
- Reply: noi: "Re: Grep For Line Containing 1or 2 Words"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Jan 2005 00:07:58 GMT
On Tue, 25 Jan 2005 22:40:59 GMT, noi wrote:
> 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
No, it would not.
$ cat text.tmp
aertyu
bdfgh tyui
cdfghj cvbn dfghjkl
dwert uiop mnbv hgfds
$ grep -v --regexp=" " > text.new < text.tmp
$ cat text.new
aertyu
$
... and, where's that guy handing out this week's UUOCA?
- Next message: Tom Rauschenbach: "Suse cron vs. Slackware cron"
- Previous message: Mark Healey: "udev and Kyocera 7135 smart phone."
- In reply to: noi: "Re: Grep For Line Containing 1or 2 Words"
- Next in thread: noi: "Re: Grep For Line Containing 1or 2 Words"
- Reply: noi: "Re: Grep For Line Containing 1or 2 Words"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|