bash - Parsing data from traceroute command -


I try to parse the "number of hops" value and output it by using the traceroute I am doing a bash script with

any sign? Thanks a lot.

My script looks like this so far:

  #! / Bin / bash #parse traceroute hops and stdout for output Echo -n "Enter a host name (such as www.google.com):" Hostname traceroute 2 & gt; 1 and host name | Grep "hops" echo "is the number of hops" " 

did you take it Looking for the number of hops, or the "64 Hops Max" value? If it is pre-use, then use tail to get the last line of output, then print the first column awk for:

  traceroute "$ hostname" 2 ", / dev / null | Tail-1 Awk '{print $ 1}'  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -