I need to replace word everywhere in the files in the home directory.
For example the word flippy needs to be flipper for every file.
Anyone know the command for find and replace words in all files directory wide?
Thanks, Steve![]()
I need to replace word everywhere in the files in the home directory.
For example the word flippy needs to be flipper for every file.
Anyone know the command for find and replace words in all files directory wide?
Thanks, Steve![]()
cd to the directory you want, then
replace "flippy" "flipper" -- *
to replace every occurance
Originally Posted by PWSowner
Great thanks, also do you know how to go into sub directories like this as well.
So /home/all/folders get checked for the word and replaced in each file.
Thanks,
I often use following format.
grep -rl 'flippy' * | xargs perl -p -i -e 's/flippy/flipper/'
But with care:
check if you get the right files with:
grep -rl 'flippy' * (say while you are within /home )
If yes, then run the full cmd
Anup