Anders, Thanks - I'll see if I can persuade one of the PERL people here to have a go.
Ta. george > -----Original Message----- > From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]] > Sent: 11 February 2003 12:24 pm > To: George Pitcher > Cc: [EMAIL PROTECTED] > Subject: RE: [PHP-WIN] reading lines from a file > > > before you do anything else, you need to do the following: > > * decide what data in this file that you need > * create a data model based on this data > * sufficiently normalize your data > * implement a database schema according to the normalized data > * write a parser that parse data according to the RDBMS schema. > * load data in the RDBMS > * finished > > > That's what you need to do, and as far I can understand none > of the above activities are related to PHP at this moment. > > However, it should be fairly easy to write a parser for > this kind of record layout. I see no major problem with > it. > > I would recommend you to consult a professional programmer, > or at least a programmer with some experience with C/C++ or > perl or whatever, and he will for sure be able to make a > parser for you according to some specification that you > can work out together with him/her. (I've seen worse > record layout in my days. ;) > > I am sorry for not being able to give you the answer > you wish for. > > //Anders > > P.S. I am just a bit curious on how big this "huge file" is? D.S. > > > -----Original Message----- > > From: George Pitcher [mailto:[EMAIL PROTECTED]] > > Sent: Tuesday, February 11, 2003 12:59 PM > > To: Svensson, B.A.T. (HKG); [EMAIL PROTECTED] > > Subject: RE: [PHP-WIN] reading lines from a file > > > > > > Yes, I suppose I do. > > > > I want to be able to take my file, work out a complete of fieldnames and > > then create an array which could then be used to, initially, > create a table > > in MySQL. > > > > I'm not using MySQL for my main system which is based on > FileMaker, but will > > be moving later this year to MySQL, so it's not a wasted effort. > > > > I know that I can export the MySQL data and push that into FileMaker. > > > > Below (in between ==== lines, is a sample record for parsing. > This may help > > you understand the problem I have. > > > > ======================================================= > > NEWRC -T&F eBook data rec.1534 |@ 27/01/2003 > > VISBN 0203445570 > > OSBN 0-203-44557-0 > > EBK1 0203548310 > > EBK2 0203651057 > > EBK3 020375381X > > EBK4 0203273567 > > OTOP > > OTART > > OTI Creative Mathematics > > OSUB > > USAU Upitis |f Rena |u Queens University |c Kingston, Ontario |x Canada > > USAU Phillips |f Eileen |u Teacher |c Vancover |x Canada > > USAU Higginson |f William |u Queens University |c Kingston |x Canada > > EDIT > > INTRO > > FORWD Pimm |f David |u The Open University x| UK > > TRANS > > 2BIND 0415164621 |P 70.00 |U 100.00 |B Hb |A |M 1 |T Creative > Mathematics > > VPR 11.99 > > USPRI 17.99 > > OTBPR 19.99 |U 25.95 |D 17/07/1997 > > USBDG > > MFDT > > ERT GB US CA AU NZ ZA IE > > ORT > > NRT > > TTY > > OBIND eB > > PDUE 11/03/2002 > > VIZE > > VEXT 192 > > OILLS 40 illustrations > > LEVEL > > OSER > > OIMP RoutledgeFalmer > > LIBPR > > OALT > > OPPQ > > OCATL This book shows how creative maths can <I>really</I> > work. Exploring > > the ways in which maths skills can be learned through cross-curricular > > activities based on visual arts and music, the book presents maths as a > > meaningful and exciting subject which holds no fears for > children.<BR> The > > authors recognise that while maths-phobia prevails in our increasingly > > mathematicised world, attitudes and approaches to teaching the > subject need > > to be reviewed, and issues such as gender stereotyping, which encourage > > maths-apathy, need to be tackled at an early stage.<BR> Within this > > collection of classroom-based stories are detailed examples of > integrative > > mathematic projects; these will give teachers the confidence to try out > > cross-curricular activities in their classes. The book also > provides support > > with difficult areas such as assessment, planning and development.<BR> > > Fascinating to read in its own right this book will appeal to > the specialist > > and non-specialist alike.<BR> > > OCONC This book shows how creative maths can <I>really</I> > work. Exploring > > the ways in which maths skills can be learned through cross-curricular > > activities based on visual arts and music, the book presents maths as a > > meaningful and exciting subject which holds no fears for > children.<BR> The > > authors recognise that while maths-phobia prevails in our increasingly > > mathematicised world, attitudes and approaches to teaching the > subject need > > to be reviewed, and issues such as gender stereotyping, which encourage > > maths-apathy, need to be tackled at an early stage.<BR> Within this > > collection of classroom-based stories are detailed examples of > integrative > > mathematic projects; these will give teachers the confidence to try out > > cross-curricular activities in their classes. The book also > provides support > > with difficult areas such as assessment, planning and development.<BR> > > Fascinating to read in its own right this book will appeal to > the specialist > > and non-specialist alike.<BR> > > OCATS Exploring the ways in which maths skills can be learned through > > cross-curricular projects on arts and music, this book presents > maths as a > > meaningful and exciting subject which holds no fear for children. > > OQUO 'This is a fascinating book ... which gives detailed case > studies.' |I > > Infant Equipment > > OCNT > > FCONT > > OWRIT > > VEDIT 1 > > BICAC U > > BSUB1 J > > BSUB2 JD > > BSUB3 > > BICAV RF > > SUBJ1 SB150000 > > SUBJ2 > > SUBJ3 > > VPROD EB > > VACDE WEB > > CREAT MFK - AUTO |D 2002 07 19 > > ================================================================ > > > > the use of '|' denotes a subfield. My plan is to name the > subfield by the > > name of the field followed by '_' and the subfield identifier, > so that the > > one on the last line would appear as 'CREAT_D, and that way > I'll be sure to > > properly tag those that are belonging to the 'counter-affected' fields. > > > > All help is appreciated. > > > > Cheers > > > > George > > > > > -----Original Message----- > > > From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]] > > > Sent: 11 February 2003 11:03 am > > > To: George Pitcher; [EMAIL PROTECTED] > > > Subject: RE: [PHP-WIN] reading lines from a file > > > > > > > > > Then you need to write a parser. What's the basic problem then? > > > > > > > -----Original Message----- > > > > From: George Pitcher [mailto:[EMAIL PROTECTED]] > > > > Sent: Tuesday, February 11, 2003 11:59 AM > > > > To: Svensson, B.A.T. (HKG); [EMAIL PROTECTED] > > > > Subject: RE: [PHP-WIN] reading lines from a file > > > > > > > > > > > > Yes, eventually. I want to come up with a good method because > > > this file is > > > > going to be supplied to me on a fairly regular basis. > > > > > > > > George > > > > > > > > > -----Original Message----- > > > > > From: Svensson, B.A.T. (HKG) [mailto:[EMAIL PROTECTED]] > > > > > Sent: 11 February 2003 10:56 am > > > > > To: George Pitcher; [EMAIL PROTECTED] > > > > > Subject: RE: [PHP-WIN] reading lines from a file > > > > > > > > > > > > > > > What do you want to do? Parse the file into tab-delimited data > > > > > in order to bulk load it into the database? > > > > > > > > > > > -----Original Message----- > > > > > > From: George Pitcher [mailto:[EMAIL PROTECTED]] > > > > > > Sent: Tuesday, February 11, 2003 11:41 AM > > > > > > To: [EMAIL PROTECTED] > > > > > > Subject: [PHP-WIN] reading lines from a file > > > > > > > > > > > > > > > > > > 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 [EMAIL PROTECTED] > > > > > > > > > > > > www.ingenta.com > > > > > > Ingenta: Empowering the exchange of academic and > > > professional content > > > > > > online. > > > > > > > > > > > > > > > > > > -- > > > > > > PHP Windows Mailing List (http://www.php.net/) > > > > > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > > > > > > > > > > > > > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php