bash - Print a value from a URL string using shell commands -
i have url string (such http://10.58.206.10:20002/job-cache/job/548) in file. string need print ip address value (i.e, 10.58.206.10).
this ip address vary often, need "the value coming after http:// , before :20002". using grep , sed below, wasn't able exact value.
grep -i "result url:" taf.log | sed 's/^.*http://'
you can avoid grep use single sed:
sed -e '/result url:/s~.*http://([^:]+):.*~\1~' taf.log wiki
Comments
Post a Comment