Date: Wed, 29 Nov 2017 10:37:25 -0800 From: Craig Leres <leres@ee.lbl.gov> To: bsd-lists@BSDforge.com, FreeBSD Hackers <freebsd-hackers@freebsd.org> Subject: Re: sort(1) sorting IP (v4) addresses (INET_ATON?) Message-ID: <5bdff83a-52c2-ddfb-3d8a-9d260a6e62da@ee.lbl.gov> In-Reply-To: <1f2d985d685f66ad01ff2810cbb941c9@udns.ultimatedns.net> References: <1f2d985d685f66ad01ff2810cbb941c9@udns.ultimatedns.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On 11/29/17 10:35, Chris H wrote: > I'm constantly dealing with IPv4 addresses (millions). Sorting the mass > is never perfect, and I'm forced to *visually* fix those out of order. > Yet I continue to (later) find some I've missed -- I'm sick of it! > Thus far, I've found I attain the best results with sort(1): > > sort -t . -k 4,4n -k 3,3n -k 2,2n ./TCPLIST | sort -g>./SORTED > > Which ends up pretty damn close. But not perfect. % grep sortip ~/.cshrc a sortip "sort -t. +0 -1n +1 -2n +2 -3n +3 -4n" Craig
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5bdff83a-52c2-ddfb-3d8a-9d260a6e62da>