Never tried it but I also found a command called agrep in the "UNIX POWER TOOLS" book that says that it accepts "or" "and" and patterns.
len -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rick DeNatale Sent: Monday, February 20, 2006 5:14 PM To: Triangle Linux Users Group discussion list Subject: Re: [TriLUG] Learn something new every day. On 2/20/06, Jason Tower <[EMAIL PROTECTED]> wrote: > you can also combine multiple targets in one command. for example, i > run the following in a screen session on all of my mail servers: > > tail -f /var/log/mail/info |grep -v -e pop3d -e imap > > the -v is a reverse grep, it returns everything -except- lines that > match the target. i don't care about seeing each user that retreives > their mail via pop or imap, i just want to see smtp messages. > > jason But this isn't exactly what Brian was after which was to display lines which had both foo and bar, presumably in either order. Multiple expressions -e foo -e bar will display lines which contain either foo or bar, as will the equivalent 'grep -F foo bar' One way to do this is grep -e 'foo.*bar' -e 'bar.*foo' You should also be able to do grep -e 'foo.*bar|bar.*foo' but I can't seem to get that to work. And by the way, this all reminds me of a new toy I recently discovered, but haven't really played with yet. multitail lets you tail multiple files and/or command outputs (a al watch) either in multiple ncurses windows, or combined, and apply different regex patterns to select and/or color the results. -- Rick DeNatale Visit the Project Mercury Wiki Site http://www.mercuryspacecraft.com/ -- TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug TriLUG Organizational FAQ : http://trilug.org/faq/ TriLUG Member Services FAQ : http://members.trilug.org/services_faq/ -- TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug TriLUG Organizational FAQ : http://trilug.org/faq/ TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
