LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-13-2008, 06:55 PM   #1
lumix
Member
 
Registered: Mar 2007
Distribution: Hardy (Gnome on Ubuntu 8.04) on Compaq N600c laptop
Posts: 323

Rep: Reputation: 30
How can sed (or any other such utility) replace `x\"y' with `x\\\"y'?


The problem is that I need to turn

Code:
x\"y
into

Code:
x\\\"y
because when I echo the string I still need an escaped quote left over. Echo de-escapes the
Code:
\"
part of it so I need to escape the escape, er, sorta.
 
Old 05-13-2008, 08:05 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
Code:
echo 'x\"y' | sed 's/x\\"y/x\\\\\\"y/'
x\\\"y
You were right--you have to "escape the escapes"---"\\" means a literal "\"
 
  


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
How to write a bash script to replace all "KH" to "K" in file ABC??? cqmyg5 Slackware 4 07-24-2007 09:00 AM
Replacing "function(x)" with "x" using sed/awk/smth Griffon26 Linux - General 3 11-22-2006 10:47 AM
"multiboot utility" and "dell utility partition" on dell i5150 xround Linux - Laptop and Netbook 5 04-21-2005 09:19 AM
how can i replace "lilo" with "grub"....... b0nd Linux - Newbie 5 04-18-2005 04:52 AM
can I replace text with the result of "wc" using sed? BrianK Linux - General 1 04-21-2004 01:15 PM


All times are GMT -5. The time now is 02:31 PM.

Main Menu
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