Escape character not working in shell script
Anyone a clue why I get the following error message in this shell script:
-bash-2.05b$ more test | awk '{print "SELECT * FROM sitelist WHERE A LIKE " \" $1 "." $2 "." $3 \" }' awk: cmd. line:1: {print "SELECT * FROM sitelist WHERE A LIKE " \" $1 "." $2 "." $3 \" } awk: cmd. line:1:---------------------------------------------^ backslash not last character on line Apparently the backslash is not interpreted as an escape character here :( (I put the '-' there myself because the error message was pointing wrong in my copy-paste) Thx, Philip |
hi,
looks like you did not close the print statement in awk. Dont use a DOT . for stringconcat, it is not needed in awk This works: echo "AA BB CC" | awk '{print "SELECT * FROM sitelist WHERE A LIKE "$1" "$2" "$3" "}' and results in: SELECT * FROM sitelist WHERE A LIKE AA BB CC You get the point? |
All times are GMT -5. The time now is 11:15 PM. |