LJ Archive

Listing 2. Example Script for Generating an HTML-Formatted Page for Reading Log Files

#!/bin/sh

echo '<h1>Log files in /var/log</h1><p>'
echo '<table border=1>
<tr><th>Name<th>date<th>size<tr>'
ls -ld /var/log/* | \
sed -e "s/^[-rwxds]*[ 0-9]* \([a-z0-9A-Z]* *\)\{2\}
\([0-9]*\) \([A-Za-z]\{3\}
*[0-9]\{1,2\} *[0-9:]*\)
\(.*\/\)\(.*\)/<td><a
href=http:\/\/myhost.mydomain
\/\4\5>\5<\/a><td>\3<td
align=RIGHT>\2<tr>/"
echo '</table>'
LJ Archive