in reply to parse a log file
looking at your script, there are a few things that could be improved upon.
~you're using warnings twice, with perl -w, and use warnings. you don't need both.
~why is use strict commented out?
~this is confusing~
probably it's better to split first, then search on the filename field, otherwise you may run into a year 2560 bug ;)#Look only at the summary lines where $_ == 560 while (defined ($_ = <FILE>)) { next unless ($_ =~ /560/); #we only want the files with 560 $_ =~ s/`/,/g; #this is here to get the user name because ' i +s after name @x=split(/,/); if (!($x[16] =~ /Primary User Name: CISERFS1/)) { #dont want t +he details from the sytem
~also, you are assigning temporary variables, but i don't see a real need, if you're only printing them.#Look only at the summary lines where $x[???] contains '560' while (<FILE>) { @x=split /,|`/; next unless ($x[???] =~ /560/); #we only want the files with 560 unless($x[16] =~ /Primary User Name: CISERFS1/) { #dont want t +he details from the sytem
~Particle
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: parse a log file
by Anonymous Monk on Jul 03, 2001 at 21:53 UTC | |
by particle (Vicar) on Jul 03, 2001 at 22:31 UTC |