#!/bin/csh

foreach fl ( `ls -1 *.html` )
    if ( `grep -c '2013/images' ${fl}` > 0 ) then
        echo $fl
        sed -e 's/<img src="/<img src="..\/archives\/metwatch\//' ${fl} > ${fl}_new
        mv ${fl}_new ${fl}
    else if ( `grep -c '<img src="images' ${fl}` > 0 ) then
        echo $fl
        sed -e 's/<img src="/<img src="..\/archives\/metwatch\/2013\//' ${fl} > ${fl}_new
        mv ${fl}_new ${fl}
    endif
end
exit


   #sed -e 's/<img src="images/<img src="\/2013\/images/' ${fl} > ${fl}_new
   sed -e 's/<img src="\/2013/<img src="2013/' ${fl} > ${fl}_new
   mv ${fl}_new ${fl}
end
