PHP - extract character range from text file
Posted on 2011-09-23
I have a collection of structured text files in a folder. Each file contains over 100 fields. All the fields are fixed length (space delimited) so they appear in exactly the same position in each file. What I want to do is write PHP a script that will allow me to read each file and grab 3 fields between certain character positions. I need to write the values from each file to a text file (one line per file, comma separated between the fields).
There are well over 5000 files in the folder so alternatively I can write this to a MySQL table if this is more practical?
Is this possible and how would I go about it?