#!/bin/ash
#
# This script does the following
# removes html tags from $1 and places the output in $2
# removes the duplicate "Index of ..." line from $2 and places the output in $3
# copies $3 back to $1
# removes $2 and $3

cat $1 | sed -e 's/<TITLE>.*TITLE>//g' > $2
cat $2 | sed -e 's/<[^>]*>//g' > $3
cp $3 $1

# removing empty lines
cat $1 | sed '/^$/d' > $3
cp $3 $1

# replace /na_admin/logs with /etc/log and 
# /na_admin/cores with /etc/crash 
cat $1 | sed -e 's#/na_admin/logs#/etc/log#' > $3
cp $3 $1
cat $1 | sed -e 's#/na_admin/cores#/etc/crash#' > $3
cp $3 $1

# adding blank lines to the end of the file
echo "" >>$1
echo "" >>$1

rm $2
rm $3
