I have awhole bunch of files and I want to edit stringA with stringB without changing the filename.
I have tried the following sed commands:
sed "s/stringA/stringB/g" *
This will print the correct results but does not actually save it with the new content of the file. when I do a cat on the filename it still shows stringA.
I personaly prefer perl for string replacement instead of sed
#/bin/bash
printf "Enter the String to be replaced: "
read ostring
printf "Enter the String to be substituted: "
read rstring
printf "Enter the Path of the files: "
read path
cd $path
files = `ls`
for file in $files
do
perl -p -i -e 's/$ostring/$rstring/' $file
done