[ILUG] Sed/Awk Substitution Question

Winston, Rory rory.winston at bankofamerica.com
Mon Jun 4 17:06:58 IST 2007


Thanks Kevin. Sed is also amazing :-) 

-----Original Message-----
From: Kevin Lyda [mailto:kevin at ie.suberic.net] 
Sent: 04 June 2007 17:01
To: Winston, Rory
Cc: ilug at linux.ie
Subject: Re: [ILUG] Sed/Awk Substitution Question

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.



Notice to recipient:
The information in this internet e-mail and any attachments is confidential and may be privileged. It is intended solely for the addressee. If you are not the intended addressee please notify the sender immediately by telephone. If you are not the intended recipient, any disclosure, copying, distribution or any action taken or omitted to be taken in reliance on it, is prohibited and may be unlawful.

When addressed to external clients any opinions or advice contained in this internet e-mail are subject to the terms and conditions expressed in any applicable governing terms of business or client engagement letter issued by the pertinent Bank of America group entity.

If this email originates from the U.K. please note that Bank of America, N.A., London Branch and Banc of America Securities Limited are authorised and regulated by the Financial Services Authority.



More information about the ILUG mailing list