# using the single quote character in an awk print statement



## mike909 (Apr 9, 2009)

How do I use a single quote character in an awk statement? For example:


> awk '{print "gnome-terminal -e \"ssh \'xyz\'\@"$1"\""}' file


I can escape the double quote character just fine, but trying to escape the single quote character results in the carret prompt.


> awk '{print "gnome-terminal -e \"ssh \'xyz\'\@"$1"\""}' file
> >


The exact string I'm trying to create is:


> gnome-terminal -e "ssh 'x y'@$1"


_$1 is an ip address from file_


----------



## mike909 (Apr 9, 2009)

solution:
escape x then put in the ascii hex for the ascii character designation of '


> awk '{print "gnome-terminal -e \"ssh \x27x y\[email protected]$1"\""}' file
> **/QUOTE]


----------

