I am using nmap to scan my network and want to show every device that is up. The following works great:
ips=$(nmap -sn 192.168.1.68/24 -oG - | awk '/Up$/{print $2, $3}')
What I now want to to is to save every output in a seperate variable.
Lets say ips
give this output:
$ echo "$ips"
xxx.xxx.x.1 (device1)
xxx.xxx.x.2 (device2)
xxx.xxx.x.3 (device3)
I now want to save (device1) in var1
,(device2) in var2
and (device3) in var3
How could I do that ?