linux - plus 100 with the last ip address -
i have list of ip address in foo.txt,like this:
192.168.0.10
192.168.0.11
192.168.0.12
...
want ping them this:
ping -c 2 192.168.0.110
ping -c 2 192.168.0.111
...
means last number of ip in foo.txt plus 100.
how can write shell script automaticly.
thank answer.
you use awk:
awk 'begin { fs = "." }; { system("ping -c 2 " $1 "." $2 "." $3 "." $4+100) }' foo.txt
this separates string ".", uses system make system call command , adds 100 last octet.
Comments
Post a Comment