Solved

Getting sed : command garbled

Posted on 2006-06-25
6
1,271 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:Kdo
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 11

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
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…
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.:

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now