#! /bin/ksh #Find all files that contain johnf14246/gen_mail_states all_files=`ls *.html` print "$all_files" change_list="" for file in $all_files do print "Now working on $file" anything=`egrep "johnf14246/gen_mail_states" <$file` print "grepping $file" if [[ -n $anything ]] then change_list="$change_list $file" print "$file has been added to the change list." fi done #Copy these files to a safe place mkdir safe_place cp $change_list safe_place #For each file replace old string with new string mkdir new_files for file in $change_list do sed 's/johnf14246\/gen_mail_states/gfsjohnf\/gen_mail_states/g' <$file >new_files/$file done #cp new_files/* . # Write nasty email to Bill Gates saying "I could never have done this # with windows :-P" # mail -s "U R A Weenie" bgates@microsoft.com # The first three steps are optional but the last is obligatory ;-) # end of code