regex - Awk BEGIN example -
$ cat tables.txt | awk 'begin { rs="\nstation" fs="\n" } { print $1 } '
running above command in above format or script gives me desired output.
08594: sal , cape verde
but if try running same in cli single gives me error syntax. doing wrong here?
$ awk 'begin { rs="\nstation" fs="\n" }{ print $1 }' tables.txt
you can use:
awk 'begin { rs="\nstation"; fs="\n" }{ print $1 }' tables.txt
i.e. use ;
terminate 1 assignment before starting i.e. fs="\n"
.
Comments
Post a Comment