Avatar of jewbolt
jewbolt

asked on 

Simple awk just not working - please help

I'm trying to get an awk to work that will look at a file that is | delimitered and print out a field value.
For some reason I can't get it to work and it keeps complaining about a missing } character.
As a test I tried some basic web samples, and they fail in a similar way.
eg.
root> sed 1q /etc/passwd | awk '{ FS = ":" ; print $1 }'
 syntax error The source line is 1.
 The error context is
                { FS = ":" >>>   <<<
 awk: The statement cannot be correctly parsed.
 The source line is 1.
        awk: There is a missing } character.

I'm running this on HP-UX B.11.31 U ia64, but I got the same error on a old SCO server too.

Can someone please put me out of my misery. I must be missing something very simple.

Thanks

Unix OS

Avatar of undefined
Last Comment
Tintin

8/22/2022 - Mon