Solved

Getting sed : command garbled

Posted on 2006-06-25
6
1,331 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
[X]
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
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

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

632 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