Hi all,
I've got a datafile that i need to upload into a mysql db. The data looks something like this, aka a chunk:
1|10/1/2004 10:23:08|"NAME: SomeAlert
DESC: Some description here.
and more description
some continued data here
and lastly continued here.
"
and there are something like 2000 of these "chunks"
The first digit before the first pipe, 1 in this case (but goes up to > 2000|), I'm not concerned about data wise.
I was hoping that each of those chunks was 1 line...but they are not. There are new lines for each line. What I really wanted to be able to do was to split or explode like:
$theFile = file('somefile.txt');
foreach ($theFile as $line) {
list($num, $dateRaw, $alert) = split ('\|', $line)
}
but that won't work because not each line has the pipe.
I've got a work around to grab the first two chunks, but not the 3rd chunk...basically everything after the 2nd pipe on the first line. that 3rd chunk needs to remain intact (with the returns, or newlines) for each row entry into the db.
This "format" is consistent throughout the data file, but the alert, or third chunk varies in length greatly (but does have a starting and ending double quote).
Any ideas on how I can grab that 3rd chunk in it's entirety?
Thanks!