From owner-freebsd-questions@FreeBSD.ORG Thu Jul 26 20:26:09 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 1DC3216A419 for ; Thu, 26 Jul 2007 20:26:09 +0000 (UTC) (envelope-from peter@boosten.org) Received: from ra.egypt.nl (cp268254-a.landg1.lb.home.nl [213.51.103.48]) by mx1.freebsd.org (Postfix) with ESMTP id D16BF13C45A for ; Thu, 26 Jul 2007 20:26:08 +0000 (UTC) (envelope-from peter@boosten.org) Received: from ra.egypt.nl (localhost.egypt.nl [127.0.0.1]) by ra.egypt.nl (Postfix) with ESMTP id 1D2B53989F; Thu, 26 Jul 2007 22:26:07 +0200 (CEST) Received: by ra.egypt.nl (Postfix, from userid 501) id E512F39884; Thu, 26 Jul 2007 22:26:06 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.2.1 (2007-05-02) on ra.egypt.nl X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=ALL_TRUSTED, AWL autolearn=ham version=3.2.1 Received: from [127.0.0.1] (xp.egypt.nl [192.168.13.35]) by ra.egypt.nl (Postfix) with ESMTP id 1FDC23987B; Thu, 26 Jul 2007 22:26:03 +0200 (CEST) Message-ID: <46A9035A.8030308@boosten.org> Date: Thu, 26 Jul 2007 22:26:02 +0200 From: Peter Boosten User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060516 Thunderbird/1.5.0.4 Mnenhy/0.7.4.666 MIME-Version: 1.0 To: "P.U.Kruppa" References: <20070726214006.X54947@small> In-Reply-To: <20070726214006.X54947@small> X-Enigmail-Version: 0.95.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Antivirus: avast! (VPS 000760-3, 07/26/2007), Outbound message X-Antivirus-Status: Clean X-Virus-Scanned: ClamAV using ClamSMTP Cc: freebsd-questions@freebsd.org 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 20:26:09 -0000 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... Peter -- http://www.boosten.org