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

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -