in reply to Re: Regex stored in a scalar
in thread Regex stored in a scalar

I do like your sed suggestion. I have a snippet I've used for 20 years to either process 1 or many files, and it's fast and low load. I've changed 10's of thousands of files on a server in mear moments (after extensive testing of course!! to save restoring)

This command will find and replace the string 'old' with 'new' in all files with the htm/html extension recursively from where you run the command. be careful, there's no undo! Use your regex as usual. Hopefully someone will find this snippet useful, I sure have 1000's of times!

find . -name '*.htm*' -type f | xargs sed -i 's/old/new/g'