#!/bin/sh -x DIRHEAD=/home/lconrad/homepage/ URLHEAD="./" cd $HOME/Mail/wwwacct # # take the messages and put them into alllines # grep -l wwwacct * | xargs cat >$HOME/homepage/stats/alllines # # get a count of how many uniq lines there are for each page # cd $HOME/homepage/stats cat alllines | awk '{print $7}' | grep '~lconrad' | sed 's;//;/;'| grep -v '\.in\.' | sort | uniq -c | sort -n -r >allpages cat allpages | sed "s;/~lconrad/;$DIRHEAD;" | sed "s;/~lconrad$;$DIRHEAD/homepage.html;" >allfiles # # save the previous table # mv -f tablines.tex tablines.`date +%s`.tex # # For each file, get the creation date and modification date, and write a line # LaTeX table line, # for FILE in `cat allfiles | awk '{print $2}'` do BASEH=`basename $FILE .html` BASE=`basename $FILE` if [ "$BASEH" = "$BASE" ] then # not html CREATION='---' else # there are lines in the html files like: # # # or ls -l gives a line like: # -rw-rw-r-- 1 lconrad lconrad 4076 Dec 3 10:21 ../serpent.html grep "Created: " $FILE >created if [ "$?" = 0 ] then CREATION=`cat created | awk '{printf ("%s %s, %s\n", $4, $5, $8)}'` else CREATION='---' fi fi if [ -f $FILE ] then MODIFIED=`ls -l $FILE | awk '{printf "%s %s", $6, $7 if (length($8) == 4) {printf ", %s", $8} printf "\n"}'` else MODIFIED="---" fi ACCESSES=`grep "$FILE$" allfiles | awk '{print $1}'` PUBFILE=`echo $FILE | sed "s;$DIRHEAD;;"` URL=`echo $FILE | sed "s;$DIRHEAD;$URLHEAD;" | sed 's;_;\\_;'` if [ ! -d $FILE ] then if [ -s $FILE ] then HREF="$PUBFILE" fi fi if [ -z $HREF ] then HREF=$PUBFILE fi echo "$HREF" '&' $ACCESSES '&' "$CREATION" '&' "$MODIFIED" '\\ \hline' >>tablines.tex done # # convert the LaTeX table to a html table. # the sed is because tth wants to make my url's print correctly in html, and # doesn't care if they work. # the awk is because tth puts titles into the body of the html, # and the w3 browser (and allegedly the dtd standard) # doesn't recognize them there. # cat table.tex | /home/lconrad/bin/tth | sed -e 's/<//g' >../usage_table.htm chown lconrad *