Rodolfo Bandeira

Rodolfo Bandeira

software, electronics, security, devops, thoughts

Search on all php files, replace some string asking confirmation and exclude some directory from this search

Using Unix command line interface, how to search on all php files, replace some string asking confirmation and exclude some directory from this search?

find . -name "*.php" ! -path "./DIRECTORY_TO_EXCLUDE/*" -exec vim -c '%s/YOUR_OLD_STRING/YOUR_NEW_STRING/gc' -c 'w!' -c 'q' '{}' \;

Last modified:

LinkedIn
WhatsApp