AV1611 Posted February 27, 2007 Share Posted February 27, 2007 I have a log file that I can currently use php's FTP functions to download, parse out, etc. What I need to figure out how to do is to "truncate" the file. For example, if the file is 800 lines long, I need to make sure it gets cut off at 500 hundred lines... but the catch is it needs to be the LAST 500 lines... foreach ($log as $line_num => $line) { [code] Q: How do I "count" the number of lines in the doc $log so I can count up to the starting line and then parse in to a new text file the last 500 lines, then I can upload the file to the server? Or, Is there an easier way? [/code] Link to comment https://forums.phpfreaks.com/topic/40306-modify-text-file/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.