Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 07-04-2008, 02:35 AM   #1
LQ Newbie
Registered: Jul 2008
Posts: 8

Rep: Reputation: Disabled
sed editor ?

DEar friends.

I want to use sed editor to change a line in file1.

in a bash script file RES_DATA_FILE name is taken and, I want to use this name in sed editor as in the following.

RES_DATA_FILE=$(ls -t1 test* | head -1)
(sed 's/read-data/read-data $RES_DATA_FILE/' file1> file2)

sed editor changing the sitring as "read-data $RES_DATA_FILE". $ operator does not work.
I woould be pleased if you could help.

thank you.

note: thank you very much *Mr. C.* for your answer to my previous question.
Old 07-04-2008, 02:44 AM   #2
Mr. C.
Senior Member
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 62
Single quotes prevent variable interpolation. Use double quotes.

The parenthesis around your sed command actually run the command in a sub-shell. No need for the parens.

note: you're welcome!


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
knowing the stream editor SED yawe_frek Programming 2 12-31-2007 11:18 AM
sed (stream editor) problem igor.R Linux - Newbie 11 12-01-2007 10:44 PM
SED Editor or not? RIG12 Programming 6 06-27-2007 12:25 PM
bash script with grep and sed: sed getting filenames from grep odysseus.lost Programming 1 07-17-2006 11:36 AM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 06:12 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:14 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration