fomatting output with ‘sed’

Lets have some pracice with sed…

consider the following lines

64 bytes from tdevi (192.168.16.100): icmp_seq=20. time=253. ms
64 bytes from tdevi (192.168.16.100): icmp_seq=21. time=251. ms
64 bytes from tdevi (192.168.16.100): icmp_seq=22. time=257. ms

I need only the icmp_seq and time field

First only icmp_seq

less ping-ms01.out |sed ‘s/.*://’|sed ‘s/.*q=//’ will result

22. time=257. ms

Then for time

sed ‘s/.\ time=/,/’ will result

22,257.ms

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: