Mailinglist Archive: opensuse (2425 mails)
| < Previous | Next > |
Re: [SLE] Simple regular expression
- From: moseley@xxxxxxxx (Bill Moseley)
- Date: Thu, 08 Jun 2000 23:47:28 -0700
- Message-id: <3.0.3.32.20000608234728.01c93b44@xxxxxxxxxxxxx>
At 08:04 AM 06/09/00 +0200, Koos Pol wrote:
>>How can I make an 'and' with a regular expression ? I 'm trying to select
>>lines from a file that has "root" and "exit" with grep. Thanks a lot
>
>cat file | grep root | grep exit
>
>cat file | perl -pe '/root/ && /exit/ && print'
-p says print. So that would print all lines once and the ones that match
twice.
perl -ne 'print if /\broot\b/ && /\bexit\b/' file
Of course one would want to define what a word is.
Bill Moseley
mailto:moseley@xxxxxxxx
--
To unsubscribe send e-mail to suse-linux-e-unsubscribe@xxxxxxxx
For additional commands send e-mail to suse-linux-e-help@xxxxxxxx
Also check the FAQ at http://www.suse.com/Support/Doku/FAQ/
| < Previous | Next > |