4 ms·
I imagine you wrote this sarcastically, but I do like this a lot!
by Gabrys1 1y ago
I imagine you wrote this sarcastically, but I do like this a lot!
- fragmede 1y agoThe original sort (and ping, and traceroute) could just have been updated to handle the newer format, rather than creating new utilities, was my non-sarcastic point. :)
- thesuitonym 1y agoTrue of ping and traceroute, but sort is not a network utility, so editing it to specifically handle IPv6 addresses is kind of a weird idea. Not necessarily a bad idea, but it makes sense that nobody has done it. Probably better in this case would be to have a small program that expands IPv6 addresses that you could then pipe into sort. That would be more in-keeping with the Unix Way™.
- pantalaimon 1y agoHow often do you need to sort IP addresses to begin with?
- j16sdiz 1y agoWhen you have lots of addresses and subnets, and want to see which addresses goes into what subnet
- fragmede 1y agoespecially since ipv6 can be multi-homed. on corporate networks you ended up with difficult configurations and need to figure out why the packets are going the wrong way frequently.
- Symbiote 1y agoIt could be reasonable to extend sort to support a hexadecimal numeric sort. It already supports numeric (decimal) and human-readable with SI prefixes (2k, 1G).
- thesuitonym 1y agoHexadecimal sort is already the same as alphabetic sort. The main problem with IPv6 addresses is that zeroes get truncated all over the place. :: could mean :0000: or :0000:0000:0000:. It's not impossible to solve by any means, but pure hexadecimal sort wouldn't work.
- fragmede 1y ago> Probably better in this case would be to have a small program that expands IPv6 addresses that you could then pipe into sort. That would be more in-keeping with the Unix Way™. I went and wrote this and then realized you'd need two utilities. One to expand the addresses, and one to minify the addresses, so your pipeline would be: cat ipv6-addrs.txt | ipv6expand | sort -V | ipv6minify vs cat ipv6-addrs.txt | sort -6 The unix philosphy is do one thing and do it well. Ideally sort does sorting very well, including sorting of ipv6 addresses. Ergo, sort should handle ipv6 address sorting.
- blueflow 1y agoUsually ping6 and traceroute6 are symlinks to the regular util, not a different program.
- hinkley 1y ago`sort -n` works remarkably well on `du`’s output