Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sed substitute text from 2nd file - both to 3rd file 1

Status
Not open for further replies.

jaxler

Programmer
May 15, 2004
1
US
I need a sed script to substitute text from a 2nd file.
For Example:
I have a file (file1.txt) that has the string 08/01/2004 in the middle of it.

I need a sed script to write all records from
file1.txt to file3.text and to substitute from file2.txt
09/01/2004 (that's the only thing in file2.txt) when it finds the 08/01/2004 in file1.txt before writing to file3.txt

Thanks,
Jim
 
Try this syntax:

sed "s!08/01/2004!$(<file2.txt)!g" file1.txt > file3.txt

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top