#!/bin/sh
#
#NAME
#  FRp - Find and Replace 
#
#SYNOPSIS
#  FRp pattern replacement
#
#DESCRIPTION
#  This script searches all the files under the current directory,
#  looking for instances of the (perl) pattern.  When found, they
#  are replaced with the replacement string.
#
#OPTIONS
#  None.
#
#SEE ALSO
#  pgrep, a perl-coded version of grep.
#  Rp, which does the pattern match and replacement.
#
#AUTHOR
#  John Chambers <jc@trillian.mit.edu>

if [ $# -ne 2 ]; then echo Usage: pattern replacement; exit 1; fi

find . -type f | xargs pgrep -l "$1" | xargs Rp "$@" 

