reading lines from a file
| From: | George Pitcher | Date: | Tue, 11 Feb 2003 10:41:13 +0000 |
| Subject: | reading lines from a file | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-18447@lists.php.net to get a copy of this message | ||
Hi,
I have a huge file that I want to get into a db format.
There are over 5000 records and I need to create fieldnames on the fly.
Each record comprises a number of lines (fields) containing 2 elements
(fieldname [first 5 chars (which need rtrimming)], value [rest of line, some
with lots of text]).
Some fieldnames are duplicated within a record so I need to rename these by
using a counter which is reset for each record (there are at least 5
fieldnames that are affected this way - so 5 counters).
Some values contain subfields so I need to be able to handle these, but this
doesn't look frightening.
And I would like to end up with an array with keys (fieldnames) and values.
But I'm stuck at the first hurdle because I can't find out how to put a line
into a string.
Any pointers?
George in Oxford
===
George Pitcher
HERON Technical Manager
Ingenta plc
23-38 Hythe Bridge Street, Oxford, OX1 2ET
T +44 (0)1865 799137 direct
T +44 (0)1865 799000 switchboard
F +44 (0)1865 799134
E george.pitcher@ingenta.com
www.ingenta.com
Ingenta: Empowering the exchange of academic and professional content
online.