Below is the unix oneliner to search and replace string in all files with extension .txt: perl -pi -e “s/<search string >/<replace string >/g” *.txt Example to search and replace string – “Cold” with “Hot” in all files with extension .txt: perl -pi -e “s/Cold/Hot/g” *.txt