I am copying an awk script from a book, trying to translate it to Windows XP from unix. It works if I put it all on one line in the script, but otherwise I get error messages referring to the line breaks. I tried ending the line with forward or backward slashes (a la C programming), but to no avail. Here is the script (script2.bat) that only runs on one line:
I invoke it with
C:> sed -f namestate list | script2
(I have a separate sed script that is operating on the file "list", with the results piped to script.bat)
Code:
gawk -F, "{ print $4 \", \" $0}"
| sort |
gawk -F, "$1==LastState{ print \"\t\" $2}
$1!=LastState {LastState=$1;
print $1;print \"\t\" $2}"
C:> sed -f namestate list | script2
(I have a separate sed script that is operating on the file "list", with the results piped to script.bat)