Date: Thu, 22 Apr 2004 16:34:45 -0500 From: Dan Nelson <dnelson@allantgroup.com> To: JJB <Barbish3@adelphia.net> Cc: "freebsd-questions@FreeBSD. ORG" <freebsd-questions@freebsd.org> Subject: Re: Specifying sort fields Message-ID: <20040422213441.GC4370@dan.emsphone.com> In-Reply-To: <MIEPLLIBMLEEABPDBIEGMEJHFMAA.Barbish3@adelphia.net> References: <MIEPLLIBMLEEABPDBIEGMEJHFMAA.Barbish3@adelphia.net>
next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Apr 22), JJB said: > How to specify the fields the sort program is to sort on? > > My file has blanks between the fields and I want to sort on > field number 9 which is ip address. > > I want to sort filea and put results in fileb. > > A sample of the sort command to be used from the command line would > go an long way to understanding how to use it. Somthing like "sort -k 9bn < filea > fileb" should work, but it will end up sorting only the first octect. If you can get your addresses to be 0-padded (000.000.000.000), you can drop the 'n' from the sort command and just do a plain ascii sort. -- Dan Nelson dnelson@allantgroup.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040422213441.GC4370>