We recently migrated an awk script to Solaris 8 from HP. We are now receiving errors when running the script. The awk script is called by a shell script which passes data to the awk script to be formatted and displayed. We’ve tried code modifications, and changing to gawk or nawk, which eliminate the errors, but the data is not displayed. Any help is greatly appreciated.
Error Messages:
awk: syntax error near line 4
awk: illegal statement near line 4
awk: syntax error near line 5
awk: illegal statement near line 5
Data:
id 1
ver 1
os UNIX
osver 7
step ABC
eend 01/01/2000
done
Code:
#!/usr/bin/awk -f
/id|ver|os|osver|step|eend|done/ {
x[$1]=$2" "$3" "$4" "$5" "$6" "$7" "$8" "$9;
gsub(/ /,"",x[$1]);
sub(/ $/,"",x[$1]);
if ($1 == "done") {
if (header_done == 0) {
printf("\nBug is fixed in\n");
printf("%-5s %-12s %-20s %-20s %-10s %-10s\n", "ID#", "Version", "OS", "St
ep", "Est end", "Done");
header_done = 1;
}
printf("%5d %-12s %-20s %-20s %-10s %-10s\n", x["id"], x["ver"], x["os"]" "x
["osver"], substr(x["step"],1,20), x["eend"], x["done"]);
}
}
awk: syntax error near line 4
awk: illegal statement near line 4
awk: syntax error near line 5
awk: illegal statement near line 5
Data:
id 1
ver 1
os UNIX
osver 7
step ABC
eend 01/01/2000
done