Solved

Getting sed : command garbled

Posted on 2006-06-25
6
1,317 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
LastLogonTimeStamp Attribute 7 49
aix tls version 6 651
mobaxterm not able to change directory 28 379
Showing a username in UNIX and using that name in the script 4 74
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…
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…
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 navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

752 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