in reply to Reading two lines per loop iteration
sounds like an XY problem to me. Why not something like this <pseudocode>?
Update After I finished writing this, I discovered FunkyMonk had already hit on essentially the same plan. ++, FunkyMonk
# Get the data into an array, or grab it a line at a time; # Read a line/array element to a var, $input; # ie, up to the first + return $may_be_a_full_entry_or_may_not = $input; Loop and read the next line to $input; use a regex to see if it starts with "day\t" if (it matches) { STORE $may_be_a_full_entry_or_may_not; s/"blank"//; # or use a capturing regex # whatever that is: tab, space, multi-spaces??? # be careful to make only the first "blank" go a +way! STORE $input; } else { s/"blank"//; # or use a capturing regex $input = $may_be_a_full_entry_or_may_not; . $input; # concat the +two lines STORE $input to your db; }
repeating until done.
The details of the loop are left to you. Note, this is a) in-elegant and b) won't work, obviously, if the data entry folk spread their daily report over 3 lines.
Update2 Fixed formatting. Thank you, injunjoel!
|
|---|