I'm trying to remove the following string from several files.
<img heigth="1" width="1" border="0" src="http://myteenmovies.net/t.php?id=5540372">
I'm using the following script
#!/bin/bash
# This script will search and replace all regular files for a string
# supplied by the user and replace it with another string.
#
# Written by Daniel McCarthy
# daniel.mccarthy@linuxphile.org
#
function usage {
echo ""
echo "Search/replace script"
echo " Written by Daniel McCarthy"
echo " daniel.mccarthy@linuxphile.org"
echo " http://linuxphile.org"
echo ""
echo "Not enough parameters provided."
echo "Usage: ./$0 replacestring"
echo ""
}
#check for required parameters
if [ ${#1} -gt 0 ];
then
for f in `find -type f`;
do
if grep -q $1 $f;
then
cp $f $f.bak.replace
echo "The string $1 will be replaced in $f"
sed s/$1//g < $f.bak.replace > $f
fi
done
else
#print usage informamtion
usage
fi
I have tried the following, but no luck.
./replace.sh '\<img heigth\=\"1\" width\=\"1\" border\=\"0\" src\=\"http:\/\/myteenmovies\.net\/t\.php\?id\=5540303\"\>'
Thank you