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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

any sed gurus?

Status
Not open for further replies.

sumgirl

IS-IT--Management
Mar 19, 2003
55
US
I have an odd request...I have a parent directory with several child directories. Each child directory has a file named "template" in it. I would like to insert one line into every "template" file in every child directory. I want this new line to contain the path and file name for that "template" file. I have been fiddling with different, failed methods of doing this all morning.

Anyone? Please help!
 
Could you not do a:

for i in `find /parentdirectory -name template`
do
echo $i >> $i
done

This would print the path and filename and append to the end of each file.
 
What a doofus I am! I was so wrapped up in doing this with a one line sed command that I totally ignored the obvious and simplest solution...thanks!
-d
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top