[PLUG] complex expressions with egrep

Paul Heinlein heinlein at attbi.com
Wed May 22 00:52:21 UTC 2002


On 21 May 2002, Ed Sawicki wrote:

> I have log files that I want to grep to extract only log
> entries that meet the following requirement:
> 
> string1 and (string2 or string3)
> 
> Is there a better way?

Better? Not my call. Workable? Yep:

  perl -ne 'print if /string1/ && /string2|string3/' logfile.txt

--Paul Heinlein <heinlein at attbi.com>






More information about the PLUG mailing list