Jump to content

Modify Text File...


AV1611

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.