in reply to Append lines to csv
Thanks for quick replies.
Re. Perldoc's sysread - I see I can read a certain number of bytes from file end, which definitely helps as they grow bigger, but don't I need to read certain number of LINES to put .csv into array? That would be neat. Do I need to open another question for this?
Re. backup management - I certainly can do that but from my POV it makes it slightly more complicated than I want - today's "new" file is tomorrow's "old" and has to be found in the old location and has to have the old filename. Simply appending a few lines seems to be easier, but yes, I already plan to control what scripts I want to execute with a relatively simple BASH program, I can add a line at the end, when everything else is done, and copy "new" files into the place of "old" ones. That's one solution.
Re. push(@file,[4,5,6]); - this sounds exactly like what I was looking for. Alternatively, I see I can open files in append mode but then I'm not sure how I could add multiple lines.
For brevity, in append mode, I'd have to have something like this $csv->print($fh, $row); going in a loop before I close $fh?
push() looks a bit more appropriate, will go an test it.
Re. databases - I plan to work with these files on two different computers alternatively, so sometimes I have to add only one or two lines and sometimes would I need to catch up and add twenty or even two hundred. It's easier to have them in files I can just copy over with a usb stick if need arises. With perl scripts on the same stick I can do my things on practically any computer, I upload results to be seen online anyway.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Append lines to csv
by Jim (Curate) on Jan 10, 2014 at 01:31 UTC |