[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: awk usage question



On Thu, 2003-05-29 at 20:19, Kevin Coyner wrote:
> 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.
<snip>
what do you mean by 'to the right of'? After the 7th field of a line?
or after the 7th line in the file
'messages' is suppose to be in the 7th word in the line?
 
cat outputfile | awk '($7 == "message"){print $0}'
this will output a line in the 7th word is 'message'
-K
-- 
Kevin Mark <kmark@pipeline.com>

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: