I'm trying to filter a file from tcpdump (actually tethereal) using awk,
but am stuck in one spot.

In words, what I'd like to do is:

    1.  only read lines with the word "Message" in it
    2.  in lines with "Message", output everything to the right of the
        word "Message".  This could be one word or twenty words.

Note that the word "Message", when it occurs in a line, always is in
record number 7.

Here's what I've come up with:

tethereal -r fileToRead | sed -n '/Message/p' |   \
    nawk  '{text=""; for( i=7; i<=NF; i++) text=text+$i; print $text}'
 

This produces output, but gives me all records where the word "Message"
occurs in a line, rather than just the records to the right of the
record containing "Message".

I'm sure there's plenty of ways to do this.  I'd be happy just knowing
one of them!  :-)

Thanks
Kevin

-- 
Kevin Coyner
mailto: [EMAIL PROTECTED]
GnuPG key: 1024D/8CE11941

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to