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

Re: awk usage question



Kevin Coyner <kevin@rustybear.com> writes:

> 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.

I'd do this with sed, not awk:

  sed -ne 's/.*Message//p'

(By default, don't print lines [-n]; use an expression [-e] that
replaces an arbitrary number of characters followed by the word
"Message" with nothing, and print the result.)

-- 
David Maze         dmaze@debian.org      http://people.debian.org/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
	-- Abra Mitchell



Reply to: