|
|
Joined: Dec 1999
Posts: 30,867
Master Elite Member
|
For all files in the current directory, change some textThis script iterates all files in the current directory changing a string to another string in each file. Just make sure the TEXT-TO-BE-CHANGED does not contains pound signs (#). Hope it saves someone some time.
#!/bin/bash
for file in *
do
sed 's#TEXT-TO-BE-CHANGED#TEXT-TO-CHANGE-TO#g' <$file >$file.temp
rm -f $file
mv $file.temp $file
done
|
|
|
|
|