From owner-freebsd-questions@FreeBSD.ORG Thu Jul 26 21:12:02 2007 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 52D2A16A417 for ; Thu, 26 Jul 2007 21:12:02 +0000 (UTC) (envelope-from don.hinton@vanderbilt.edu) Received: from mailgate04.smtp.vanderbilt.edu (mailgate04.smtp.Vanderbilt.Edu [129.59.1.75]) by mx1.freebsd.org (Postfix) with ESMTP id 15AC613C458 for ; Thu, 26 Jul 2007 21:12:01 +0000 (UTC) (envelope-from don.hinton@vanderbilt.edu) Received: from smtp10.smtp.vanderbilt.edu (smtp10.smtp.Vanderbilt.Edu [129.59.1.11]) by mailgate04.smtp.vanderbilt.edu (8.13.8/8.13.8) with ESMTP id l6QKauXf023749 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Thu, 26 Jul 2007 15:36:56 -0500 Received: from smtp10.smtp.vanderbilt.edu (localhost [127.0.0.1]) by smtp10.smtp.vanderbilt.edu (8.12.11/8.12.11/VU-3.7.9C+d3.7.9) with ESMTP id l6QKauab001243; Thu, 26 Jul 2007 15:36:56 -0500 (CDT) Received: from [192.168.0.2] (c-68-52-255-63.hsd1.tn.comcast.net [68.52.255.63]) by smtp10.smtp.vanderbilt.edu (8.12.11/8.12.11/VU-3.7.9.3B+d3.7.9) with ESMTP id l6QKapoc001223 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 26 Jul 2007 15:36:52 -0500 (CDT) From: Don Hinton Organization: ISIS To: freebsd-questions@freebsd.org Date: Thu, 26 Jul 2007 15:36:44 -0500 User-Agent: KMail/1.9.7 References: <20070726214006.X54947@small> <46A9035A.8030308@boosten.org> In-Reply-To: <46A9035A.8030308@boosten.org> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart1272859.8bWHbmNLyD"; protocol="application/pkcs7-signature"; micalg=sha1 Content-Transfer-Encoding: 7bit Message-Id: <200707261536.44548.don.hinton@vanderbilt.edu> X-Proofpoint-Virus-Version: vendor=fsecure engine=4.65.5502:2.3.11, 1.2.37, 4.0.164 definitions=2007-07-26_07:2007-07-26, 2007-07-26, 2007-07-26 signatures=0 X-PPS: No, score=0 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: "P.U.Kruppa" , Peter Boosten Subject: Re: awk question X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Jul 2007 21:12:02 -0000 --nextPart1272859.8bWHbmNLyD Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Thursday 26 July 2007 15:26:02 Peter Boosten wrote: > P.U.Kruppa wrote: > > Hi (and sorry for this slightly OT question), > > > > I would like to extract the second last field of each line of a file > > called user.csv . > > So I try > > > > > awk '{print $(NF-1)}' user.csv > > > > awk: trying to access out of range field -1 > > input record number 1, file user.csv > > source line number 1 > > > > Obviously $(NF-1) doesn't do the trick. Any better idea? > > Hmmm, works for me it does... Me too, except of course if the first line of user.cvs is blank... > > Peter =2D-=20 Don Hinton or Institute for Software Integrated Systems (ISIS), Vanderbilt University tel: 615.480.5667 or 615.870.9728 --nextPart1272859.8bWHbmNLyD--