Recursively Replace Text in Files
-
I need to replace text in all text files in the directory (including sub-directoies). I have managed to get the following working, but dont know how to combine them!
find . -exec grep –n "oldText" '{}' \; -print
find . -type f -name '*.read' -print -exec sed s/oldText/newText/g '{}' \;
ANy suggestion please, I have done searches, but just want a simple one line command if possible. Regards, Andy.
grahamfff
-
I need to replace text in all text files in the directory (including sub-directoies). I have managed to get the following working, but dont know how to combine them!
find . -exec grep –n "oldText" '{}' \; -print
find . -type f -name '*.read' -print -exec sed s/oldText/newText/g '{}' \;
ANy suggestion please, I have done searches, but just want a simple one line command if possible. Regards, Andy.
grahamfff