Computing.Net > Forums > Unix > passing echo string over to sed

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

passing echo string over to sed

Reply to Message Icon

Name: lamos
Date: April 26, 2004 at 11:42:21 Pacific
OS: Solaris
CPU/Ram: 1GB
Comment:


Can someone help? I'm trying to pass an echo string over to sed in order for sed to insert it into a text file (test) as such:

echo "echo "ps -ef | grep `pwd | awk -F/ '{print $5}'`/config | awk '{print \"kill -9 \" $2}' | sh"

I'm trying to pipe (|)it over to sed as such
sed '1s/^$/' textfile > test.

When I bring up the test file, the echo string is not in it. I wish to insert the string after the "#!/bin/sh" entry.
Real Newbie



Sponsored Link
Ads by Google

Response Number 1
Name: Dlonra
Date: April 26, 2004 at 14:25:25 Pacific
Reply:

in works, what are you tryimg to do?


0

Response Number 2
Name: Dlonra
Date: April 26, 2004 at 14:26:44 Pacific
Reply:

should have been:
in words what are you tryimg to do?


0

Response Number 3
Name: lamos
Date: April 26, 2004 at 16:24:09 Pacific
Reply:

In basic terms,

I would like to pipe an echo string into a sed command string that can place the above echoed string on the 2nd line of a text file.

Thx for your help.


0

Response Number 4
Name: Wolfbone
Date: April 26, 2004 at 18:52:34 Pacific
Reply:

I don't think that's the kind of answer Dlonra was looking for. We've already solved that exact same problem in the earlier thread but now you seem to have gone back to square one, trying to do whatever it is you're trying to do in one indecipherable line of shell commands.

What we need to know is what you are trying to achieve. You are giving us a collection of commands strung together and asking us why it doesn't work but we don't even know what it's meant to be doing. From our point of view it's like you've dumped a pile of machine parts in front of us and said: "Fix this please" but we don't know whether it's meant to be a motorcycle or a washing machine.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


replace data in a file Check if variable starts ...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: passing echo string over to sed

Pass environment variables to sed www.computing.net/answers/unix/pass-environment-variables-to-sed/7387.html

can I pass an awk variable to the s www.computing.net/answers/unix/can-i-pass-an-awk-variable-to-the-s/7251.html

string to number www.computing.net/answers/unix/string-to-number/5537.html