LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 07-04-2008, 03:35 AM   #1
wolfindark
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, 03:44 AM   #2
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 61
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!
 
  


Reply


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 12:18 PM
sed (stream editor) problem igor.R Linux - Newbie 11 12-01-2007 11:44 PM
SED Editor or not? RIG12 Programming 6 06-27-2007 01:25 PM
bash script with grep and sed: sed getting filenames from grep odysseus.lost Programming 1 07-17-2006 12:36 PM
Insert character into a line with sed? & variables in sed? jago25_98 Programming 5 03-11-2004 07:12 AM


All times are GMT -5. The time now is 03:55 AM.

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