Problem with sed and awk

Warren Block wblock at wonkity.com
Thu Feb 26 06:30:21 PST 2004


On Thu, 26 Feb 2004, [iso-8859-2] Roub=ED=E8ek Zden=ECk (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=3D";" {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


More information about the freebsd-questions mailing list