Error while using awk: Unmatched '.
Hello,
While running awk directly on terminal (not in any script), I am getting an error (I guess it's very common) if I try to use multi-liner awk code: Code:
# nawk 'BEGIN{ Code:
example# awk 'BEGIN{FS=" "}; /string/ {gsub(/string/,"",$0); print $0}' infile Code:
example# awk 'BEGIN{ |
Are you using a bash or (t)csh shell?
I do believe a (t)csh shell throws that error, while bash does not. You can do the following in both shells: Code:
awk 'BEGIN{ \ |
I can't reproduce your problem with nawk (or with gawk) with the example line you've given. Perhaps a section of your infile, say 10 or 20 lines would help diagnose?
A thought: you may have unmatched quotes in your file. A other thought: shouldn't matter ('cause nawk doesn't care about such things) but try inserting spaces; e.g., Code:
nawk 'BEGIN { FS=" " } /string/ {gsub(/string/,"",$0); print $0}' infile Yet another thought: try it in KornShell instead of C-Shell. Hope this helps some. |
You're right @druuna! I was also doubtful with execution shell.
This is a pb with tcsh and traditional /sbin/sh. But worked fine with bash. Thanks everyone! |
All times are GMT -5. The time now is 03:53 AM. |