Re: Parsing my big file - I'm back

From: Date: Tue, 11 Mar 2003 11:54:54 +0000
Subject: Re: Parsing my big file - I'm back
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-139117@lists.php.net to get a copy of this message
I would like to help you bu I whant to see at least 2 records from your file ... i didn't understand the format very well.. On Tue, 2003-03-11 at 12:29, George Pitcher wrote: > Hi all, > > I asked the question a couple of weeks ago and started off some kind of > disagreement. > > I don't want to spark things off again, so if anyone wants to reply, fine - > if not, fine too. > > The program,mers here have had a go with Perl and got halfway before other > work pressures have put this on the back burner (at least another week). > > I'd still like to do this with PHP and would like some guidance at > nitty-gritty level rather than on the concept (but a bit of that as well). > > My text file has a return at the end of every field and the only thing that > separates the records is the name of the company who supplied the file. > > Within each 'field' there are subfields, with a completely different > separator '|'. > > I expect to start by doing a quick and dirty search replace for the '|x' > with '[return]|x', adding spaces to pad the label out so that the following > value will match the start position of other values. > > My plan is then to loop through the file and create an array for each field > with the key set to the field label and the value set to the 'value' (of > course). > > I need to take account of duplicate field labels within some records by > adding an index to each field label (nested loop). > > Finally, I need to gather these arrays into a bigger array set at record > level. > > Can anyone see any flaws in this approach? I've not done this sort of stuff > for about 5 years, and that was using Frontier on a Mac. > > All helpful suggestions appreciated > > George > > === > > 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. -- Mincu Alexandru intelinet.ro Tel:+4 0745 369719 +4 021 3140021 www.intelinet.ro office@intelinet.ro

« previous php.general (#139117) next »