LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Other *NIX
User Name
Password
Other *NIX This forum is for the discussion of any UNIX platform that does not have its own forum. Examples would include HP-UX, IRIX, Darwin, Tru64 and OS X.

Notices

Reply
 
Search this Thread
Old 04-17-2008, 07:45 AM   #1
mmunir
LQ Newbie
 
Registered: Apr 2008
Posts: 1

Rep: Reputation: 0
Could not run SED command


I am using solrais 10 on sun sparc.

The following command executes successfully

echo c:/test.txt | sed -e 's/\//\\\//g'

But when i executes the following command

x=`echo c:/test.txt | sed -e 's/\//\\\//g'`

I get the following error

sed: command garbled: s/\//\\//g

Is there any way to avoid this error. I am using the Bash shell.
 
Old 04-17-2008, 07:54 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,127

Rep: Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985Reputation: 985
Use a different separator - say ":"
 
Old 05-04-2008, 09:35 PM   #3
eggixyz
Member
 
Registered: Apr 2008
Posts: 310

Rep: Reputation: 30
Yes,

Using a different separator is the preferred way to do it. As you can see below, this will solve your problem, but it's really easy to get lost in all the onion-peeling involved with all the escapes

x=`echo c:/test.txt | sed -e 's/\//\\\\\//g'`

Best wishes,

Mike
 
Old 05-05-2008, 06:07 AM   #4
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,245
Blog Entries: 15

Rep: Reputation: 233Reputation: 233Reputation: 233
try
Code:
x=$(echo "c:/test.txt" | sed -e 's@/@//@g')
 
  


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
sed command help viveksnv Programming 3 02-26-2008 07:40 AM
sed command help jaredhanks Linux - General 4 08-15-2006 04:19 PM
sed command ancys Programming 3 08-05-2006 09:30 AM
sed command ancys Programming 5 08-03-2006 11:39 PM
sed command kwigibo Linux - General 3 04-21-2002 04:11 PM


All times are GMT -5. The time now is 10:03 AM.

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