#! /bin/ksh # Take out beginning of each web page, and cat in a new standard header. # all_files=`ls *.html surnames/*.html` #takemout = "$HOME/Public/html/takemout" putemin = "$HOME/Public/html/putemin" print "$all_files" change_list="" for file in $all_files do print "Now working on $file" anything=`egrep "top.location=self.location" <$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 if [[ ! -d safe_place ]] then mkdir safe_place fi if [[ ! -d safe_place/surnames ]] then mkdir safe_place/surnames fi #cp $change_list safe_place #For each file replace old string with new string mkdir new_files for file in $change_list do print -n " now working on $file ... " cp $file safe_place/$file sed -e '//,/_top\">/d' <$file >new_files/$file cat putemin new_files/$file >new_files/temp/$file print "done" done #cp -r new_files/* . # end of code