Reputation: 61
I'm getting syntax error for below line. Not sure what is the syntax error.
bash-3.2$ awk -F"|" '{ if ($4 != "N.A." && $29 =="1") printf("%s|testfile\n", $4) >> "out1.txt" else if ($4 != "N.A." && $29 =="2A") printf("%s|testfile\n", $4) >> "out2.txt" }' infile
awk: syntax error near line 1
awk: illegal statement near line 1
Upvotes: 1
Views: 1184
Reputation: 203219
You're using old, broken awk (/bin/awk on Solaris). On Solaris use /usr/xpg4/bin/awk.
Upvotes: 1