#### whatsnew.sh #### #### Description: #### #### whatsnew.sh will recurse through a directory tree #### and find all html files with a timestamp within #### X number of days. The results are written to html #### files in the current directory with names based on #### file dates #### #### For example, running whatsnew.sh 3 on Sept 14 would find #### all files with a date stamp between Sep 12-14. #### Files named Sep_12.html, Sep_13.html, Sep_14.html #### would be created #### #### The main index file is YYYY.html, i.e., 2003.html #### This file is created by running: #### #### makeyear.sh YYYY #### #### Usage: #### #### whatsnew.sh number_of_days #### #### ### ### ### cd /var/www/tech/new cat /dev/null > tmp2.out if [ "$1" = "" ] then xdays=1 else xdays=$1 fi find .. -name \*.html -daystart -mtime -$xdays -print | \ grep -v bak\/ | \ grep -v analysis\/ | \ grep -v depot\/ | \ grep -v tmp\/ | \ grep -v tech\/ | \ grep -v status\/ | \ grep -v changelist\/ | \ grep -v \.log\/ | \ grep -v cal\/ > tmp.out for i in `cat tmp.out` do ls -l $i | cut -c44-500 | sed "s/ / /" | sed "s/ /_/" >> tmp2.out done sort tmp2.out | cut -d" " -f1 | uniq > tmp3.out i=`date | cut -c5-10 | sed "s/ /_/"` for i in `cat tmp3.out` do echo "Processing $i" nday=`echo $i | cut -d_ -f2` echo $nday grep $i tmp2.out | cut -d" " -f3 > tmp4.out cp tmp4.out tmp5.out cat /dev/null > tmpx.out for z in `cat tmp5.out` do y=`grep "<title>" $z | sed "s/<title>//" | sed "s/<\/title>//"` if [ "$y" == "" ] || [ "$y" == " " ] then y=`basename $z .html` fi echo $y >> tmpx.out done paste tmp4.out tmpx.out > tmp6.out sed "s/^/<a href=\"/" tmp6.out | \ sed "s/ /\">/" | \ sed "s/$/<\/a><\/td><\/tr>/" > tmp7.out grep $i tmp2.out | \ cut -d" " -f2,3 | \ sort | \ sed "s/^/<tr><td>/" | \ sed "s/ /<\/td><td>/g" | cut -c1-22 > tmp8.out echo "Creating $i.html..." cat /dev/null > $i.html x=`echo $i | sed "s/_/ /"` echo "<html> " >> $i.html echo "<head> " >> $i.html echo " <META content=text/css http-equiv=Content-Style-Type> " >> $i.html echo " <LINK href=\"http://www.setgetweb.com/black.css\" rel=\"stylesheet\" type=\"text/css\"> " >> $i.html echo " <title> $x </title> " >> $i.html echo "</head> " >> $i.html echo " " >> $i.html echo "<body> " >> $i.html echo "<font class=grey2> " >> $i.html echo "<blockquote>" >> $i.html echo "<blockquote>" >> $i.html echo " " >> $i.html echo "<p>&nbsp;</p> " >> $i.html echo "<h1>$x</h1> " >> $i.html echo "<p><hr> " >> $i.html echo " " >> $i.html echo " " >> $i.html echo "<p><table cellspacing=6> " >> $i.html echo "<tr><th align=left>Completed</th><th align=left> Description</th></tr>" >> $i.html paste tmp8.out tmp7.out | sed "s/ //g" >> $i.html echo "</table>" >> $i.html echo " " >> $i.html echo "<p><hr> " >> $i.html echo "<font class=grey2> " >> $i.html echo "<p>Confidential: Acme Corporation. " >> $i.html echo " " >> $i.html echo "<br> Copyright 2001. All Rights Reserved. " >> $i.html echo "<script javascript=\"JavaScript\"> " >> $i.html echo "document.write(\"<br>Last updated: \"+document.lastModified); " >> $i.html echo "</script> " >> $i.html echo " " >> $i.html echo "</blockquote>" >> $i.html echo "</blockquote>" >> $i.html echo "</body> " >> $i.html echo "</html> " >> $i.html echo " " >> $i.html done if grep "$xmonth" index.html >/dev/null 2>/dev/null then echo " " else grep -v "</body></html>" index.html > tmp.out cat tmp1.out >> tmp.out echo "</body></html>" >> tmp.out fi #rm tmp*