> how can i count the numbers of lines text of a log file
> and how do i show the number
Seems like every perl book I've ever read gave this example:
while ;
$count = $.;
The special variable $. holds the number of lines read. Of
course, it only works if you're using only one file.
jay
ECTED]>
> Date: Fri, 11 Jan 2002 12:14:38 -0800
> To: [EMAIL PROTECTED]
> Cc: [EMAIL PROTECTED]
> Subject: RE: [MacPerl] showing text lines
>
> Well, if the log file is small enough you can just loop through the file and
> increment an index at every pass and that should be go
Multi-Graphics wrote:
> how can i count the numbers of lines text of a log file
> and how do i show the number
> and how can i print for example line 5 to 15
>
> thanks
In [U,Li]n[i,u]x type this, if you want to read lines 22 through 33:
more -22 +11 /my_source_path/my_source_file
Add
> macperl <[EMAIL PROTECTED]> [MacPerl] showing
>text lines
>how can i count the numbers of lines text of a log file
>and how do i show the number
>and how can i print for example line 5 to 15
>
>thanks
PS: You
Multi-Graphics wrote:
> how can i count the numbers of lines text of a log file
Try
$lines = 0;
open(FILE, 'file') or die $!;
$lines++ while ;
close(FILE);
> and how do i show the number
To print the number of lines to STDOUT:
print "Number of lines: $lines\n";
> and how can i print for exa
how can i count the numbers of lines text of a log file
and how do i show the number
and how can i print for example line 5 to 15
thanks