You could read the file in with file(), which will give you each line as an array. Then, depending on how those strings are separated (are they by tabs, or is it just whitespace?), use strtok() to tokenize each line. If they are by space, not tab, but you know the column width, then you can just pull out each part by using substr() or similar. For the non lap/time records, just check whether the string starts with a number or not, and if not check if it starts with the known labels, e.g. "Caution Flags".
-----Original Message----- From: Dan McCullough [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 28, 2001 9:01 AM To: PHP General List Subject: [PHP] Very interesting and challenging question I need to take a file, similar to this and strip it of everything but this, and write it to a database. Are there any thoughts on how to get the information out, all the files are consistent. <!-- start strip --> Race Final Watkins Glen International 2.450 miles 31 laps ---------------------------------------------------------------------------- ---- Fin Str Driver Laps Led Pts Qual Reason Out ---------------------------------------------------------------------------- ---- <!-- end strip --> <!-- start output --> 1 2 18 Dynamike18 31 24 185 118.007 Running 2 7 68 jcordeiro 31 0 170 116.078 Running 3 5 80 MattyJ140 31 0 165 116.881 Running 4 1 28 RUDD#28 31 6 165 118.219 Running 5 13 57 1SpeedDemon 31 0 155 Running 6 9 84 legends3 31 1 155 115.131 Running 7 3 56 RobertFx3D 31 0 146 117.854 Running 8 12 55 24skids 31 0 142 98.644 Running 9 4 53 Mark_O_10 31 0 138 117.323 Running 10 8 91 JJinsane 31 0 134 116.061 Running 11 10 8 beertipper 31 0 130 114.154 Running 12 11 44 Wis>OutLaw 10 0 127 111.022 DNF 13 6 51 BdgrOtlw 3 0 124 116.702 DNF <!-- End 1st output --> <!-- Start second output --> Race time - 72:52.030 Average speed - 62.538mph Margin of victory - 1.944sec Caution flags - 7 # of lead changes - 3 Weather - Clear 70^ E 0mph <!-- End second output --> thanks for any help ===== Dan McCullough ------------------------------------------------------------------- "Theres no such thing as a problem unless the servers are on fire!" h: 603.444.9808 w: McCullough Family w: At Work __________________________________________________ Do You Yahoo!? Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month. http://geocities.yahoo.com/ps/info1 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]