On 4/27/05, JupiterHost.Net <[EMAIL PROTECTED]> wrote:
> 
> > If all you want is the last column, this is a really long way to go about 
> > it.
> >
> >     while (<V4>) {
> >         print (split)[7];
> >         print "\n";
> > }
> 
> I think that won't work due to some rows formatted like so:
> 
> 2005/01/20 15:39   17   2%  -il-o-b- - - - -  sg F01000
> 
> unless that was typo?
> 
> In that case "7" isn't always the index of the last item in the list
> from split.
> 
> while (<V4>) {
>      my @tmp = split;
>      print "$tmp[ $#tmp ]\n";
> }
> 

I was assuming it was a typo/email munge, and that the command he
pipes actually produces consistent output.  That may be a faulty
assumption on my part.  YOu know what they say about assumptions In
general, though, when parsing log files (which seems to be waht's
going on here) if you're assured reasonably consisten data, it's
better IMNSHO to look for a particular index, because loggers are more
likely to add occasional extranious info or comments at the end of the
line than in the middle.

YMMV,

Jay

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to