From owner-freebsd-questions Tue Nov 20 5:23:19 2001 Delivered-To: freebsd-questions@freebsd.org Received: from relay3-gui.server.ntli.net (relay3-gui.server.ntli.net [194.168.4.200]) by hub.freebsd.org (Postfix) with ESMTP id 39B9437B416 for ; Tue, 20 Nov 2001 05:23:14 -0800 (PST) Received: from pc3-card3-0-cust122.cdf.cable.ntl.com ([62.254.251.122] helo=rhadamanth.private.submonkey.net ident=exim) by relay3-gui.server.ntli.net with esmtp (Exim 3.03 #2) id 166Aro-0001qT-00; Tue, 20 Nov 2001 13:23:12 +0000 Received: from setantae by rhadamanth.private.submonkey.net with local (Exim 3.33 #1) id 166AqV-000KC9-00; Tue, 20 Nov 2001 13:21:51 +0000 Date: Tue, 20 Nov 2001 13:21:51 +0000 From: setantae To: Wayne Pascoe Cc: freebsd-questions@freebsd.org Subject: Re: Sort Message-ID: <20011120132151.GB77414@rhadamanth> Mail-Followup-To: setantae , Wayne Pascoe , freebsd-questions@freebsd.org References: <86r8qt7gjq.fsf@pan.ehsrealtime.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <86r8qt7gjq.fsf@pan.ehsrealtime.com> User-Agent: Mutt/1.3.23.2i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, Nov 20, 2001 at 12:50:01PM +0000, Wayne Pascoe wrote: > Hi all, > > I have a cvs file as follows : > > id,first_name,last_name,company_name > > I want to sort this on first name. Doing > cat file.csv | sort > sorts starting at the beginning of the line. > > Is there a way for sort to sort a file based on a field delimited by a > character, or should I just use a perl script ? Yes. See sort(1) and the -t and -k options. Ceri -- keep a mild groove on To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message