[ILUG] Sed/Awk Substitution Question

Kevin Lyda kevin at ie.suberic.net
Mon Jun 4 17:01:26 IST 2007


On 5/22/07, Winston, Rory <rory.winston at bankofamerica.com> wrote:
> Guys
>
> Thanks for all the clever solutions. Awk is amazing.

Um...

For these lines:

426  35.555366 165.47.59.89 -> 165.47.191.87 TCP 4326 > 6666 [PSH, ACK]
Seq=33 Ack=27198 Win=64245 Len=11
430  35.690078 165.47.59.89 -> 165.47.191.87 TCP 4326 > 6666 [ACK]
Seq=44 Ack=27370 Win=65535 Len=0

...you want:

426 35.555366 64245
430 35.690078 65535

so therefore sed will work fine:

sed 's/\([0-9][0-9]*\)  *\([0-9][0-9\.]*\).*Win=\([0-9][0-9]*\).*/\1 \2 \3/'

Kevin

-- 
Kevin Lyda - kevin at ie.suberic.net
What's wrong with the US media, example 3,732:
"History will record that [Bush and Blair] saw the threat to the West
posed by terrorism and responded courageously." -David Broder,
so-called Dean of the Washington press corp.



More information about the ILUG mailing list