hello forum memvers,
1:I have to write a script for find a string and replace with another string.
2:In shell script how to replace one string with another string.
hello forum memvers,
1:I have to write a script for find a string and replace with another string.
2:In shell script how to replace one string with another string.
Post your script over here and we'll look into it.
If you do not have a script ready, then try writing one first and then post it over here if you get stuck.
tyler_durden
I know find command to search a string but i dont know how to replace with other string. for example.
i am finding for Hosts.
find . -type f -exec grep -l "Hosts" {} \;
but idont know how to replace with "Server".
Thanks & Regards
Rajkumar g
Are you willing to rename files ?
or do you just want to generate a list of modified filename in it ?
for file in *
do
sed "s/Hosts/Server/g" $file > tmpfile && mv tmpfile $file
done
Gary