From owner-freebsd-questions@FreeBSD.ORG Thu Jul 26 20:31:04 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 43C8B16A46C for ; Thu, 26 Jul 2007 20:31:04 +0000 (UTC) (envelope-from ulrich@pukruppa.net) Received: from pukruppa.net (pukruppa.net [213.146.114.24]) by mx1.freebsd.org (Postfix) with ESMTP id A07BD13C4EC for ; Thu, 26 Jul 2007 20:31:03 +0000 (UTC) (envelope-from ulrich@pukruppa.net) Received: from pukruppa.net (localhost [127.0.0.1]) by pukruppa.net (8.14.1/8.14.1) with ESMTP id l6QKUj7t055884; Thu, 26 Jul 2007 22:30:46 +0200 (CEST) (envelope-from ulrich@pukruppa.net) Received: from localhost (ulrich@localhost) by pukruppa.net (8.14.1/8.14.1/Submit) with ESMTP id l6QKUj6M055881; Thu, 26 Jul 2007 22:30:45 +0200 (CEST) (envelope-from ulrich@pukruppa.net) Date: Thu, 26 Jul 2007 22:30:45 +0200 (CEST) From: "P.U.Kruppa" X-X-Sender: ulrich@small To: Peter Boosten In-Reply-To: <46A9035A.8030308@boosten.org> Message-ID: <20070726222855.A55804@small> References: <20070726214006.X54947@small> <46A9035A.8030308@boosten.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed 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:31:04 -0000 On Thu, 26 Jul 2007, 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... Sorry: Actually the first line of my user.csv was empty. Thanks though, Uli. > > Peter > -- > http://www.boosten.org > Peter Ulrich Kruppa Wuppertal Germany