#!/bin/sh if [ $# -lt 3 ]; then echo " usage: replace_in_tree '' replaces the string "to_be_replaced" with "replacement" from the current directory downwards the filetree in files matching filematcher, e.g. '*' or '*.html' example: replace_in_tree 'Author: Bill Gates' 'Author: Larry Wall' '*.html' " exit fi find . -name "$3" -type f | xargs -n 255 perl -pi.bak -e 's/\Q$1\E/$2/g'