Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Getting sed : command garbled

Posted on 2006-06-25
6
1,298 Views
Last Modified: 2008-03-17
Hello Dear

When I run  a sed script
 I am getting following erra when runnining the replacement


sed: command garbled: s/LINKFLAGS      = -G -mt -o/LINKFLAGS      = -G -mt/

Any hlep would be greatly appraciated

Thanks
Shawkat
0
Comment
Question by:dmshawkat
6 Comments
 
LVL 45

Expert Comment

by:Kent Olsen
ID: 16980577
Hi dmshawkat,

Are you enclosing this string in single quotes?



Kent
0
 

Author Comment

by:dmshawkat
ID: 16980603
What is the format or syntax ; where is the start and end of single quote ?

also I am running  sed -f test.sed $file > $file.out as a result I am geeting .out file

( which is the expected output ) but i have to mannually rename them to the original filename
then remove all*.out

is there a way I can overwrite the original one ?
0
 
LVL 12

Accepted Solution

by:
tel2 earned 25 total points
ID: 16982354
Hi dmshawkat,

So, you have 2 different sed commands which you have problems with, right?

1. For the one you specified in your original question, what is the exact command you're using?  (Please always include this kind of info so we can efficiently help resolve such issues).

2. For the one you specified in your 2nd question, I don't know of any way to get sed to do an "in-line" replacement.  The best I can offer, if you're wanting to do it in a single entry on the command line, is by putting 2 commands on 1 line, like this:
    sed -f test.sed $file > $file.out ; mv $file.out $file
If it's in a script, you can do that, or just put them on separate lines.
Alternatively, Perl can do in-line replacements on UNIX, so if you're happy to have a Perl solution, show us the contents of the test.sed file, and we may be able to convert it for you.
0
 
LVL 3

Assisted Solution

by:anumalas
anumalas earned 25 total points
ID: 17097335
Hello

I think

sed -f test.sed $file > $file.out ;
mv $file.out $file;

will work fine

sed will not update the file it will displays output to standard output or some output file  

I have same problem prior i have solved my problem with the above way. and onemore thing is that it will not occupy any file system space...
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question