in reply to How to parse a logfile to a HTML table format
Say you want x, y, and z in one field, and the rest of the stuff in separate fields. You can populate an array (@infile) with the lines from the log file, then do the following:xxx yyy zzz aaaaa bbb cccccccccccc...
This will create a list of lists that you can output as you need. @output is a list of references to anonymous lists populated with your desire output fields. \s parses whitespace characters, \S parses non-whitespace character. You simply arrange your parentheses to capture however many of the space delimited items you need per field.foreach (@infile) { /(\S+\s+\S+\s+\S+)\s+(\S+)\s+(\S+)\s+(.*)/; my @fields = ($1,$2,$3,$4); push @output, \@fields; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How to parse a logfile to a HTML table format
by Hofmator (Curate) on Jul 23, 2001 at 16:35 UTC |