[Israel.pm] content of big file on windows

Mikhael Goikhman migo at homemail.com
Tue Mar 16 08:00:35 PST 2004


On 16 Mar 2004 17:50:20 +0200, Pinkhas Nisanov wrote:
> 
> I need get content of big text file from end of file
> ( something like tail ) on windows. I don't want
> to open file and read it ( it's very big file ),
> just last "n" lines. What is the best way?
> ( using standard distribution module is better )

I would use the following to implement something like this if you know
lines themselves are not very long:

	open(FILE, "<hugefile.txt") or die;
	seek(FILE, -1024, SEEK_END);  # jump at 1Kb from the end
	scalar <FILE>;  # skip partial line
	print while <FILE>;
	close FILE;

Regards,
Mikhael.

-- 
perl -e 'print+chr(64+hex)for+split//,d9b815c07f9b8d1e'



More information about the Perl mailing list