Recursively replacing a string in all files in a directory

You can use the following command to change Specific string on all files under specific directory:

find /u01/directory -type f | xargs perl -pi~ -e ‘s/oldtext/newtext/g;’

Tested on Linux & AIX

Ref:
https://blogs.oracle.com/rammenon/recursively-replacing-a-string-in-all-files-in-a-directory-linux

This entry was posted in AIX, Linux, Shell Script and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

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