Date: Thu, 26 Feb 2004 07:30:19 -0700 (MST) From: Warren Block <wblock@wonkity.com> To: =?iso-8859-2?Q?Roub=ED=E8ek_Zden=ECk_=28T-Systems_PragoNet=29?= <Zdenek.Roubicek@pragonet.cz> Cc: questions@freebsd.org Subject: Re: Problem with sed and awk Message-ID: <20040226072518.N99054@wonkity.com> In-Reply-To: <9256D57F598E6C41B288AA7DB94F29C901C2D69A@pgnmail1.pgnaplikace.cz> References: <9256D57F598E6C41B288AA7DB94F29C901C2D69A@pgnmail1.pgnaplikace.cz>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 26 Feb 2004, [iso-8859-2] Roubíček Zdeněk (T-Systems PragoNet) wrote:
> Any idea what I am missing?
You don't say what you are expecting these awk samples to do...
> >cat test
^^^^
There is a command called test, so you should not use that name for test
files.
> 1;1
> 2;2
> >awk -F ';' '{print $1}'
> 1
> 2
This is doing what you've told it. The field separator is ; and it
prints the first field on each line (assuming you are actually running
it on the 'test' file--the command as shown won't do it).
> >awk -F ' FS=";" {print $1}'
> 1;1
> 2
Don't use the -F option if you are setting the field separator inside
the code.
-Warren Block * Rapid City, South Dakota USA
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040226072518.N99054>
