From owner-freebsd-questions@FreeBSD.ORG Fri Apr 23 06:00:45 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 251B916A4F5 for ; Fri, 23 Apr 2004 06:00:25 -0700 (PDT) Received: from mta11.adelphia.net (mta11.adelphia.net [68.168.78.205]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3224343D60 for ; Fri, 23 Apr 2004 06:00:23 -0700 (PDT) (envelope-from Barbish3@adelphia.net) Received: from barbish ([67.20.101.71]) by mta11.adelphia.net (InterMail vM.5.01.06.08 201-253-122-130-108-20031117) with SMTP id <20040423130017.JCUE21898.mta11.adelphia.net@barbish>; Fri, 23 Apr 2004 09:00:17 -0400 From: "JJB" To: "Dan Nelson" Date: Fri, 23 Apr 2004 09:00:17 -0400 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) In-Reply-To: <20040422213441.GC4370@dan.emsphone.com> X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 Importance: Normal cc: "freebsd-questions@FreeBSD. ORG" Subject: RE: Specifying sort fields X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Barbish3@adelphia.net List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2004 13:00:45 -0000 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