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

script for changing old to new in a textfile

Status
Not open for further replies.

schleife

Technical User
Feb 5, 2001
39
hi,
i'm looking for a shellscript, which changes "old Text" to
"new Text" whithin several files in a directory.

thank's
schleife
 
Sed is the easy way :

for file_in_list in file_range
sed 's/Old Text/New Text/g' $file_in_list > tmpfile
mv tmpfile $file_in_list
done

file_range is your list of chosen files eg *.log test* etc etc

Dickie Bird (:)-)))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top