Lucas Vieites .com Logo
Lucas Vieites .com
«I intend all my puns»

Replace a string in all files in a directory

 

This will replace "old_string" with "new_string" in all files in the "DirectoryName" directory or folder, and save the original files with the ".save" extension.

perl -e "s/old_string/new_string/g;" -pi.save $(find DirectoryName -type f)

Author:   ✦  Published:   ✦  Updated:   ✦