traceroute google.com | sed 's/ /,/g' | sed 's/ ms / ms,/g'This take load balancers into account as well, so when your route slightly changes during a hop, you can still easily grok the data coming back. Basically, take double-spaces and replace them with a comma. The second sed is what takes the load balancers into account, fixing the output so it is the same as the prior hop test.
Saturday, November 26, 2011
Easily splitting and storing traceroute data
Traceroute is very useful, but the data it spits out can be a bit tough to chew on. I came up with this one-liner to make it more CSV compatible so you can Split() on commas and have the correct data where you expect it.
Subscribe to:
Post Comments (Atom)
No need to use two pipes when one can do:
ReplyDeletetraceroute google.com | sed -e 's/ /,/g' -e 's/ ms / ms,/g'
Good catch!
ReplyDelete