Date: Wed, 29 Nov 2017 10:47:55 -0800 From: "Chris H" <bsd-lists@BSDforge.com> To: "Craig Leres" <leres@ee.lbl.gov> Cc: "FreeBSD Hackers" <freebsd-hackers@freebsd.org> Subject: Re: sort(1) sorting IP (v4) addresses (INET_ATON?) Message-ID: <69f146ebf1a122a38f52dc67be57cf91@udns.ultimatedns.net> In-Reply-To: <5bdff83a-52c2-ddfb-3d8a-9d260a6e62da@ee.lbl.gov>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 29 Nov 2017 10:37:25 -0800 "Craig Leres" <leres@ee=2Elbl=2Egov> said > On 11/29/17 10:35, Chris H wrote: > > I'm constantly dealing with IPv4 addresses (millions)=2E Sorting the mass > > is never perfect, and I'm forced to *visually* fix those out of order=2E > > 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): > >=20 > > sort -t =2E -k 4,4n -k 3,3n -k 2,2n=C2=A0 =2E/TCPLIST | sort -g>=2E/SORTED > >=20 > > Which ends up pretty damn close=2E But not perfect=2E >=20 > % grep sortip ~/=2Ecshrc > a sortip "sort -t=2E +0 -1n +1 -2n +2 -3n +3 -4n" >=20 > =09=09Craig Brilliant! Craig, you're a rock star=2E Thanks! --Chris
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?69f146ebf1a122a38f52dc67be57cf91>