in reply to How do I jump to the point I last checked a file at?
You might need to be careful with big files (>2 or 4Gb) and whatever method you use to rotate/backup log files needs to be aware of your seek position too.$log = "foo.log"; $pos_file = $log . ".pos"; $pos = 0; if( open POS, "<$pos_file" ) { $pos = <POS>; close POS; } open FILE, $log; seek FILE, $pos, 0; ...process file until eof... $pos = tell FILE; open POS, ">$pos_file"; print POS $pos; close POS;
|
|---|