LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 04-29-2004, 09:48 AM   #1
philipz
LQ Newbie
 
Registered: Apr 2004
Posts: 25

Rep: Reputation: 0
Unhappy 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
 
Old 04-29-2004, 10:58 AM   #2
huibert.alblas
Member
 
Registered: Jan 2004
Location: Duesseldorf /Germany
Distribution: Gentoo amd64 / Debian
Posts: 226

Rep: Reputation: 30
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?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Commands from shell script not working Grassie Coetzee Linux - Software 2 03-13-2005 03:31 PM
Escape character ? juanb Linux - Newbie 2 08-31-2004 11:03 AM
shell script not working sanjith11 Programming 2 07-07-2004 03:55 AM
How do I escape $# in shell scripting? KDE4me Programming 3 06-25-2003 11:35 PM
why my shell script is not working linuxlah Linux - General 4 08-01-2002 09:39 AM


All times are GMT -5. The time now is 01:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration