[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Sheflug] Re: HTML Logs



On Fri, May 16, 2003 at 01:32:28PM +0100, Richard Ibbotson wrote:
> ls -ld /var/log/* |  \
> sed -e "s/^[-rwxds]<td>*[ 0-9]* \([a-z0-9A-Z]* *\)\{2\} \([0-9]*\)
> \([A-Za-z]\{3\} *[0-9]\{1,2\} *[0-9:]*\)\/\4\5>\5<\/a><td>\3<td
> align=RIGHT>
> \2<tr>/"echo '</table>'
><snip>
> 
> I think this means that the sed part of it is very wrong ?

Probably. Something like:

ls -ld /var/log/* | perl -e 'foreach (<STDIN>) { /(\d+) (\w\w\w +\d+
+\d+(?::\d+)?) (.*)/; print "<tr><td>$3</td><td>$2</td><td>$1</td></tr>\n";}
'

... would probably work, but really you should opendir() and stuff properly,
specially if ls is doing funny ANSI coloring or something.

(Watch the wrapping on the above, it's supposed to all be on one line).

Cheers,

Alex.


___________________________________________________________________

Sheffield Linux User's Group -
http://www.sheflug.co.uk/mailfaq.html

  GNU the choice of a complete generation.