Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#11 gawk not working with single quotes

open
nobody
None
5
2004-08-18
2004-08-18
Sai
No

gawk is not working when the pattern is given in single
quotes whereas working with double quotes.

For example:
gawk '{ sum += $1 }; END { print sum }' file
gives output:
gawk: cmd. line:1: '{
gawk: cmd. line:1: ^ invalid char ''' in expression

whereas
gawk "{ sum += $1 }; END { print sum }" file
works fine.

Discussion

  • Logged In: NO

    It's not gawk's fault, it's the shell's (if at all). See my
    response to your grep-related question.