0
GNU sort -V
is great for sorting IP adresses. Unfortunately it throws all lines with leading letters (as opposed to numbers) to the bottom of the pile. Is there a way around it?
Note:
• 192.168.0.103 is missing because it's the local host.
• MACs/HW addresses have been changed.
• cat
user@host:~$ cat /proc/net/arp
IP address HW type Flags HW address Mask Device
192.168.0.106 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.1 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.101 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.104 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.110 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.108 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.107 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.102 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.105 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.100 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.109 0x1 0x2 00:00:00:00:00:00 * wlan0
• sort -V
user@host:~$ sort -V /proc/net/arp
192.168.0.1 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.100 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.101 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.102 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.104 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.105 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.106 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.107 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.108 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.109 0x1 0x2 00:00:00:00:00:00 * wlan0
192.168.0.110 0x1 0x2 00:00:00:00:00:00 * wlan0
IP address HW type Flags HW address Mask Device
hmm, that's, a lot, of, commas. – glenn jackman – 2018-10-02T14:35:21.840
Thanks, it works. I'll just leave it for a bit in case someone has something more appropriate. If not, I'll give it the big green tick. – voices – 2018-10-03T10:56:04.563