Re: grep 2 words
pk schreef:
> Patrick wrote:
>
>> hi everyone, on solaris 10 without gnu shell, how can i do to grep 2
>> word. Or 1 or 2?
>> for example i'd like to grep all lines with Feb or Mar in this file:
>> Fri Feb 29 12:00:00 2008:
>> Fri Feb 29 12:30:00 2008:
>> Fri Feb 29 13:00:01 2008:
>> Fri Feb 29 13:30:00 2008:
>> Sat Mar 1 04:00:00 2008:
>> Sat Mar 1 04:30:00 2008:
>> Sat Mar 1 05:00:00 2008:
>> Sat Mar 1 05:30:00 2008:
>> Sat Mar 1 06:00:00 2008:
>
> egrep 'Feb|Mar' file.txt
>
> or
>
> awk '/Feb/ || /Mar/' file.txt
>
awk '/Feb|Mar/' file.txt
also seems to work...
--
Luuk
|