Re: Re: parsing tricky text file

From: Date: Tue, 28 Jan 2003 11:09:24 +0000
Subject: Re: Re: parsing tricky text file
References: 1 2  Groups: php.windows 
Request: Send a blank email to php-windows+get-18132@lists.php.net to get a copy of this message
Then the authors/levels/quotes should go in a seperate table all linked to the book id (eg ISBN number wich is unique for every book) Is this the only way the publischer can produce their data. I mean it must come out of some DB like system. Jochem George Pitcher wrote:
Jochem, Yes. Where a book has multiple authors, then there is a USAU field for each, likewise for editors, levels, and quotes. And that is only from the 150 records I've looked at. george
-----Original Message----- From: J.Veenhuijsen [mailto:info@solid-digital.nl] Sent: 28 January 2003 10:56 am To: George Pitcher Subject: Re: [PHP-WIN] Re: parsing tricky text file In this record, that is true but having a look through a sample I have found at least 5 fields that have 'duplicates'. Are these duplicates in the same record? Jochem George Pitcher wrote:
J.Veenhuijsen wrote:
What I would do in this case is writing my own little parser program to spool it in to a MySQL database. I often use Delphi for this. What is the record delimiter?
The only way that you know a new record starts is the line
starts with '-'
('-T&F eBook data rec.1534 @ 27/01/2003').
OTOP with nothing behind it means emty field?
In fact there are two nword spaces there.
Execept for the USAU fields it seem all very fieldname/content like.
In this record, that is true but having a look through a sample
I have found
at least 5 fields that have 'duplicates'. I still don't see how it is going to be easy. George
Jochem George Pitcher wrote:
Hi, I'm looking for some advice. One of my suppliers (big publisher) has sent me a file
containing records of
their books. The file is anabsolute nightmare. There are approx 8000 records and the format is like this
(actual record):
-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 So as you see, the filed names are at the left hand side with the data starting at position 6 (5 if the line-start is 0). I usually
use Excell to
clean up this sort of stuff but those fields with a lot of text
in them just
get trashed in the process. I have used Frontier to parse ACARS logs in the past and I
thought that PHP
might be able to help out here. I want to be able to convert the fieldname (where it is duplicated in a record) so that each one is unique. Strip out returns,
replacing with [tab]
and the producing an output file that can be imported into a db (MySQL eventually but I'm using FileMaker right now). Any suggestions (that do not involve a pistol)? 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.
-- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.windows (#18132) next »