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;’ {} \;

Leave a Reply

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.