From owner-freebsd-hackers@freebsd.org Wed Nov 29 18:47:21 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3DF91E658C4 for ; Wed, 29 Nov 2017 18:47:21 +0000 (UTC) (envelope-from bsd-lists@BSDforge.com) Received: from udns.ultimatedns.net (static-24-113-41-81.wavecable.com [24.113.41.81]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 1B5B6805DA for ; Wed, 29 Nov 2017 18:47:20 +0000 (UTC) (envelope-from bsd-lists@BSDforge.com) Received: from udns.ultimatedns.net (localhost [127.0.0.1]) by udns.ultimatedns.net (8.14.9/8.14.9) with ESMTP id vATIlnxQ090334; Wed, 29 Nov 2017 10:47:55 -0800 (PST) (envelope-from bsd-lists@BSDforge.com) X-Mailer: UDNSMS MIME-Version: 1.0 Cc: "FreeBSD Hackers" In-Reply-To: <5bdff83a-52c2-ddfb-3d8a-9d260a6e62da@ee.lbl.gov> From: "Chris H" Reply-To: bsd-lists@BSDforge.com To: "Craig Leres" Subject: Re: sort(1) sorting IP (v4) addresses (INET_ATON?) Date: Wed, 29 Nov 2017 10:47:55 -0800 Message-Id: <69f146ebf1a122a38f52dc67be57cf91@udns.ultimatedns.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 29 Nov 2017 18:47:21 -0000 On Wed, 29 Nov 2017 10:37:25 -0800 "Craig Leres" 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