I have a directory that contains some subdirectories. I know there are two types of files, such as *A*.txt
and *B*.txt
, contain an "oldString" under that directory. I want to replace them with a "newString". Can I do this in one command? That is can I add the "*B*.txt"
somewhere in this command:
find . -type f -name "*A*.txt" -exec sed -i 's/oldString/newString/g' {} \;
-name
patterns in afind
command? – steeldriver Dec 10 '19 at 14:18