Date: Fri, 23 Apr 2004 09:00:17 -0400 From: "JJB" <Barbish3@adelphia.net> To: "Dan Nelson" <dnelson@allantgroup.com> Cc: "freebsd-questions@FreeBSD. ORG" <freebsd-questions@freebsd.org> Subject: RE: Specifying sort fields Message-ID: <MIEPLLIBMLEEABPDBIEGCEKIFMAA.Barbish3@adelphia.net> In-Reply-To: <20040422213441.GC4370@dan.emsphone.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Thank you that worked. You know that nowhere in the 'man sort' info does it say that to use sort command you have to use pipe commands to feed it data. How is somebody without UNIX programming background going to read that and know how to feed sort it's data to sort? Don't you think the man sort info needs updating to explain this fact? Even some examples at end of technical info would go long way to making the 'man sort' info user friendly and meaningfully. -----Original Message----- From: Dan Nelson [mailto:dnelson@allantgroup.com] Sent: Thursday, April 22, 2004 5:35 PM To: JJB Cc: freebsd-questions@FreeBSD. ORG Subject: Re: Specifying sort fields 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?MIEPLLIBMLEEABPDBIEGCEKIFMAA.Barbish3>