linux notes – replace text patterns in files using perl and find
If I would like to replace all ‘.html’ pattern to ‘.php’ in all html file, that will be like as following:
# find . -name “*.html” -exec perl -pi -e ‘s/.html/.php/g;’ {} \;
If I would like to replace all ‘.html’ pattern to ‘.php’ in all html file, that will be like as following:
# find . -name “*.html” -exec perl -pi -e ‘s/.html/.php/g;’ {} \;