[TriLUG] Learn something new every day.

Rick DeNatale rick.denatale at gmail.com
Mon Feb 20 17:14:23 EST 2006


On 2/20/06, Jason Tower <jason at cerient.net> 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/



More information about the TriLUG mailing list