[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl-AnyPerl] Re: seperate large file into smaller files



On Sun, Dec 17, 2000 at 11:25:27AM +0100, allan wrote:
> thanks ronald and bruce
> actually both your suggestions took exactly the same amount of time on a
> 40mb file.  i have an additional question i forgot last time.  i' d like
> to get the linenumber for the very last character of the large file
> before actually doing the seperating-procces - are there a special
> variable or a quick way to do this?

The only way to get the number of lines in the file is to read the whole
file and count the newline characters.  On Unix, you would use `wc` for
this.  On a Mac, you can use Perl:

#!perl -n
END { print "$.\n"; }
__END__

Although it might be faster to do block reads and count newlines with
tr/\n//; ...

Ronald

==== Want to unsubscribe from this list?
==== Send mail with body "unsubscribe" to macperl-anyperl-request@macperl.org