LinuxQuestions.org
Register a domain and help support LQ
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 07-08-2008, 03:42 AM   #1
kranthikumar.gatta
LQ Newbie
 
Registered: Jul 2008
Posts: 2

Rep: Reputation: 0
sed problem


Hi I am trying to replace the content LIB="common.jar" with LIB="common.jar param.jar" in a file. For doing the same, I am using the command
echo $line | /bin/sed \ -e 's/'LIB="common.jar"'/'LIB="common.jar param.jar"'/g' \.

But when I try to execute the same using a postinstall file, I am getting the error message "COMMAND GARBLED". Instead of whitespace, if I give an underscore or some other character between common.jar and param.jar, it is working fine.

Kindly guide me on how can this issue be resolved.

Thanks in advance.
 
Old 07-08-2008, 07:27 AM   #2
indeliblestamp
Member
 
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 38
It works for me if I escape the double quotes and the space.
Code:
bash-2.05b ~$ echo $line
content LIB="common.jar" with
bash-2.05b ~$ echo $line | /bin/sed -e 's/'LIB=\"common.jar\"'/'LIB=\"common.jar\ param.jar\"'/g'
content LIB="common.jar param.jar" with
bash-2.05b ~$
 
Old 07-09-2008, 01:10 AM   #3
kranthikumar.gatta
LQ Newbie
 
Registered: Jul 2008
Posts: 2

Original Poster
Rep: Reputation: 0
Hi Arun, when i use the same lines at the prompt, its working fine. But when i am including the same content in a postinstall file, its saying command garbled. Kindly sort this out.

Thanks in advance.
 
Old 07-09-2008, 03:16 AM   #4
indeliblestamp
Member
 
Registered: Feb 2006
Distribution: Fedora
Posts: 341
Blog Entries: 3

Rep: Reputation: 38
I wouldn't know, unless you paste the line as it is in your postinstall file. e.g. instead of echo $line | sed etc, it should be more like sed -e etcetc $file.
 
  


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 Problem Hydrap Linux - General 1 05-05-2006 04:25 AM
sed problem Hydrap Linux - General 3 03-30-2006 08:31 AM
Sed problem Miro1 Programming 3 04-09-2005 10:02 AM
a sed problem thanhVic Programming 5 03-02-2005 02:05 AM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 07:12 AM


All times are GMT -5. The time now is 03:03 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