LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 09-13-2013, 08:20 AM   #1
gsai0205
LQ Newbie
 
Registered: Sep 2013
Posts: 1

Rep: Reputation: Disabled
Sed substitution gives error "sed: command garbled"


Hi,

sed 's/<Cust_Output_Method><![CDATA[Paper - FI]]></Cust_Output_Method>/<Cust_Output_Method><![CDATA[PDFOUT]]></Cust_Output_Method>/g' *$1*.xml > *$1*abc.xml

When we run the above command we get the following error:
sed: command garbled:
can any one help??
 
Old 09-13-2013, 08:33 AM   #2
Habitual
LQ Addict
 
Registered: Jan 2011
Posts: 8,556
Blog Entries: 13

Rep: Reputation: Disabled
You're using variables and wildcards that suggest more than just the one line.

show us the whole script or try:

test it with
Code:
sed -e 's/<Cust_Output_Method><![CDATA[Paper - FI]]></Cust_Output_Method>/<Cust_Output_Method><![CDATA[PDFOUT]]></Cust_Output_Method>/g' source.xml
after that is satisfactory, use
Code:
sed -i 's/<Cust_Output_Method><![CDATA[Paper - FI]]></Cust_Output_Method>/<Cust_Output_Method><![CDATA[PDFOUT]]></Cust_Output_Method>/g' source.xml > output.xml

Last edited by Habitual; 09-13-2013 at 08:35 AM.
 
Old 09-13-2013, 08:34 AM   #3
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian Jessie / sid
Posts: 1,471

Rep: Reputation: 444Reputation: 444Reputation: 444Reputation: 444Reputation: 444
too many /

escape a few

and not urgent


edit

forget escaping, try these 'forms'

Code:
sed ',regexp,replacement,'
sed '~regexp~replacement~'
sed '#regexp#replacement#'

Last edited by Firerat; 09-13-2013 at 08:36 AM.
 
Old 09-13-2013, 09:01 AM   #4
szboardstretcher
Senior Member
 
Registered: Aug 2006
Location: Detroit, MI
Distribution: GNU/Linux systemd
Posts: 4,208

Rep: Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611Reputation: 1611
Quote:
Originally Posted by gsai0205 View Post
Hi,

sed 's/<Cust_Output_Method><![CDATA[Paper - FI]]></Cust_Output_Method>/<Cust_Output_Method><![CDATA[PDFOUT]]></Cust_Output_Method>/g' *$1*.xml > *$1*abc.xml

When we run the above command we get the following error:
sed: command garbled:
can any one help??
Im going to go ahead and guess that you dont need all of that. A quick:

Code:
grep 'Paper\ -\ FI' $1
will let you know... but i think this will work and be easier on the eyes:

Code:
sed 's/Paper\ -\ FI/PDFOUT/g' $1
add an -i to that when you get the correct output.
 
  


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 substitution command error carlr Programming 1 11-14-2012 08:10 PM
Sed command - command garbled errror gauavmahesh Linux - Newbie 3 03-30-2012 10:04 PM
Command substitution and sed daYz Linux - General 9 11-04-2006 01:15 AM
'sed: command garbled:' error on Solaris fatjack Solaris / OpenSolaris 3 08-25-2006 05:15 PM
sed substitution error BlkPoohba Programming 1 08-25-2004 02:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:33 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration