On May 4, Brett W. McCoy said:

>On Fri, 4 May 2001, Susan Richter wrote:
>
>> Can someone tell me what command I can use to go to machines and count the
>> lines on a certain file?  I have log files for every machines (20 all
>> together).  Each log file has lines that would equate to the files that it
>> found.  I need to know how many files are found on all the machines.  I am
>> using Perl 5 on NT.
>
>my $counter = 0;
>while(<FILE>) { $counter++; }

In fact, no counter variable is needed.  Perl supplies the $. variable,
which holds the line number of the most recently read line.

  1 while <FILE>;
  print $.;

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
Are you a Monk?  http://www.perlmonks.com/     http://forums.perlguru.com/
Perl Programmer at RiskMetrics Group, Inc.     http://www.riskmetrics.com/
Acacia Fraternity, Rensselaer Chapter.         Brother #734

Reply via email to