Last line of file/Perl

トップ ページ
添付ファイル:
Eメールのメッセージ
+ (text/plain)
このメッセージを削除
このメッセージに返信
著者: David A. Sinck
日付:  
題目: Last line of file/Perl

\_ SMTP quoth Mike Starke on 11/14/2002 15:49 as having spake thusly:
\_
\_ On Thu, Nov 14, 2002 at 12:41:50PM -0800, Matt Alexander wrote:
\_ /_tail -1 somefile ?
\_ /_
\_
\_ I was actually looking for a Perl solution without having to read
\_ through the entire file.

use File::Tail;

or perldoc -f seek, then backtrack. Something like
seek(FH,2,$suspected_last_line_size_plus_some);

Seek could be a pita, unless you're talking about a really big file.

David