0
I got an awk script named my_awk:
#!usr/bin/awk -f
{
if ($1 == "#START") { FS=":";}
else if ($1 == "#STOP") { FS = " ";}
else { print $3}
}
And I invoked it through:
cat my_file | awk -f my_awk
I'm new to awk so I'm ignorant about awk's mechanism. Will this my_awk script execute its command to the whole my_file or to each line of the file?
but how awk works of the file? The script I wrote above has successfully changed the FS separator for 2 different lines! – Zen – 2014-06-18T02:29:12.163
See my updated answer. – slhck – 2014-06-18T05:52:29.470