bug#20745: I would like to make a request for the sort command
From:
Stephane Chazelas
Subject:
bug#20745: I would like to make a request for the sort command
Date:
Mon, 8 Jun 2015 12:14:07 +0100
User-agent:
Mutt/1.5.21 (2010-09-15)
2015-06-08 12:43:32 +0200, Erik Auerswald:
[...]
> > I'm not even sure having a tool just for that specific task
> > would make sense though. Here, it sounds more like a job for a
> > high level language like perl/python... (what if I want to sort
> > on roman numerals now, week day names, astrological signs...)
>
> Well, IP addresses are often encountered on Internet connected computers.
> ;-)
And roman numerals are common in bibliography processing.
The "sort" command has nothing to do with "IP addresses".
OK, there's already a -M for month sorting (locale dependant)
useful in log sorting. There's already a -h and -V.
Those are still quite generic. But IPv4 and IPv6 addresses are
very specific (and the right sort order not necessarily obvious
(IPv4 vs v6, link-local addresses, different IPv4 notations...))
Maybe there's a way to allow that without having to implement
the specifics in sort.
Like sort key flags to invoke commands:
sort '-k1,1|ip2hex' '-k2,2n|roman2int' '-k3,3|iconv -t us//TRANSLIT'
For sort to invoke those ip2hex/roman2int/iconv shell
command lines to pre-process the sort keys before sorting.
--
Stephane