AWK - Linux vs Unix?
I am relatively new to Linux, but have worked on Solaris Unix for 15+ years. On an Ubuntu 12.04 system, I have written a very simple AWK script which continues to throw errors. By very simple I mean "pattern {action}" with just a few lines. I can't figure this out, unless there is a difference with AWK on Linux vs. Unix. But even that does not seem like there should be any issues. Below is the script & errors. Can you see any problems with this script?
donald$ cat PSA.awk { /#0/ { printf("%s %s", $2, $3) } /#1 AT/ { printf(",%s\n", $4) } /#1 EMA/ { printf(",%s\n", $3) } /\// { next } } donald$ awk -f PSA.awk $HOME/Documents/SCACL.txt awk: PSA.awk:2: /#0/ { printf("%s %s", $2, $3) } awk: PSA.awk:2: ^ syntax error awk: PSA.awk:3: /#1 AT/ { printf(",%s\n", $4) } awk: PSA.awk:3: ^ syntax error awk: PSA.awk:4: /#1 EMA/ { printf(",%s\n", $3) } awk: PSA.awk:4: ^ syntax error awk: PSA.awk:5: /\// { next } awk: PSA.awk:5: ^ syntax error |
Quote:
|
I tried that and it just moves the syntax error over...
donald$ cat PSA.awk { /#0/ printf("%s %s", $2, $3) /#1 AT/ printf(",%s\n", $4) /#1 EMA/ printf(",%s\n", $3) /\// next } donald$ awk -f PSA.awk $HOME/Documents/SCACL.txt awk: PSA.awk:2: /#0/ printf("%s %s", $2, $3) awk: PSA.awk:2: ^ syntax error awk: PSA.awk:3: /#1 AT/ printf(",%s\n", $4) awk: PSA.awk:3: ^ syntax error awk: PSA.awk:4: /#1 EMA/ printf(",%s\n", $3) awk: PSA.awk:4: ^ syntax error awk: PSA.awk:5: /\// next awk: PSA.awk:5: ^ syntax error donald$ |
Rknichols
Ignore that previous post. I re-read your post and realized which braces you were referring to. I'm now getting data from the script. Thanks!
|
Remember to mark as SOLVED once you have your solution :)
|
All times are GMT -5. The time now is 03:59 PM. |