Replace all occurrences of a a string with another inside current directory (non-recursive)
Words
32
Reading
1 min
8y
sed -i -- 's/searchforthis/replacewiththis/g' *
This will actually search for "searchforthis" in all the files in the current folder and replace all the occurrences of "searchforthis" with "replacewiththis"
What about replacing also the string in file names?:
for file in *searchforthis*; do mv -i "${file}" "${file/searchforthis/replacewiththis}"; done;