From owner-freebsd-questions@FreeBSD.ORG Mon Mar 1 07:07:21 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 B986416A4CE for ; Mon, 1 Mar 2004 07:07:21 -0800 (PST) Received: from dire.bris.ac.uk (dire.bris.ac.uk [137.222.10.60]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1038043D2F for ; Mon, 1 Mar 2004 07:07:19 -0800 (PST) (envelope-from Jan.Grant@bristol.ac.uk) Received: from mail.ilrt.bris.ac.uk by dire.bris.ac.uk with SMTP-PRIV with ESMTP; Mon, 1 Mar 2004 15:07:11 +0000 Received: from cmjg (helo=localhost) by mail.ilrt.bris.ac.uk with local-esmtp (Exim 3.16 #1) id 1AxoxO-0001sF-00; Mon, 01 Mar 2004 15:03:46 +0000 Date: Mon, 1 Mar 2004 15:03:46 +0000 (GMT) From: Jan Grant X-X-Sender: cmjg@mail.ilrt.bris.ac.uk To: =?iso-8859-2?Q?Roub=ED=E8ek_Zden=ECk_=28T-Systems_PragoNet=29?= In-Reply-To: <9256D57F598E6C41B288AA7DB94F29C901C2D69A@pgnmail1.pgnaplikace.cz> Message-ID: References: <9256D57F598E6C41B288AA7DB94F29C901C2D69A@pgnmail1.pgnaplikace.cz> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=ISO-8859-1 Content-Transfer-Encoding: QUOTED-PRINTABLE Sender: Jan Grant cc: questions Subject: Re: Problem with sed and awk X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 01 Mar 2004 15:07:21 -0000 On Thu, 26 Feb 2004, [iso-8859-2] Roub=ED?ek Zden?k (T-Systems PragoNet) wr= ote: > > Hello questions > > Any idea what I am missing? > > >cat test > 1;1 > 2;2 > >awk -F ';' '{print $1}' > 1 > 2 > >awk -F ' FS=3D";" {print $1}' > 1;1 > 2 > > The FS=3D";" is a pattern expression that is used to match the first line of input, after it has already been split into fields. It evaluates true so the block it guards is always run. After the first line has been dealt with, future lines will be split using the new FS setting. As another poster supplied, slap the FS setting in a BEGIN-guarded block. --=20 jan grant, ILRT, University of Bristol. http://www.ilrt.bris.ac.uk/ Tel +44(0)117 9287088 Fax +44 (0)117 9287112 http://ioctl.org/jan/ If it's broken really badly - don't fix it either.