Subject: Re: How to extract specific columns/line items from a CSV file?
On Tue, Sep 20, 2016 at 1:16 PM, Keith Clarke wrote:
> I’ve a large number of sizeable CSV files from each of which I need to
> extract just 2 or 3 specific columns. Creating nested iterations through
> every item
On Tue, Sep 20, 2016 at 1:16 PM, Keith Clarke wrote:
> I’ve a large number of sizeable CSV files from each of which I need to
> extract just 2 or 3 specific columns. Creating nested iterations through
> every item in every line seems somewhat inefficient - as does loading each
> full file into me
I’m late to this party (these days too busy to peruse the list more than
episodically).
Don’t know if this would be faster or slower or equivalent, but it’s a modular
function:
function getColumns pData, pColNbrs, pDelim
-- Extract specified columns from a table in order
--pData: a ta
On 20/09/2016 21:16, Keith Clarke wrote:
Hi folks, I’ve a large number of sizeable CSV files from each of
which I need to extract just 2 or 3 specific columns. Creating nested
iterations through every item in every line seems somewhat
inefficient - as does loading each full file into memory - s
Thanks Richard - the target CSVs are indeed in the 1-100MB range (containing
mostly noise data for my current purpose) and it’s always useful to know,
amongst the many roads available with LiveCode, which 'all lead to Rome', with
the same ETA! :-)
Best,
Keith..
> On 20 Sep 2016, at 22:42, Richa
Thanks Richard, that does answer my question. Repeating for each line in
an external url does load the whole thing at once. Someone remind me.. I
think I read that the "for each" no longer creates a second copy of the
data, is this correct? Or did it ever make a duplicate?
On Tue, Sep 20, 2016
Keith Clarke wrote:
> It’s interesting that the url container can be addressed directly,
> instead of loading the file
get url ("file:"& tFile)
...does the same as:
open file tFile for read
read from file until EOF
close file tFile
It's just more convenient than using the three-line m
Thanks Mike (& Craig) for confirming that iteration of some sort is the way to
go.
It’s interesting that the url container can be addressed directly, instead of
loading the file - I’d not seen that before. I’m currently pulling each file
into a regular variable, so will probably stick with tha
-columns-line-items-from-a-CSV-file-tp4708690p4708694.html
Sent from the Revolution - User mailing list archive at Nabble.com.
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your
If a file you can do this..
repeat for each line tline in url "file:yourfilename.csv"
put item 1 of tLine & comma & item 3 of tline & comma & item 15 of tLine &
return after tExtracted
end repeat
delete the last char of tExtracted -- remove the extraneous return
Or you can put them into an array
Hi folks,
I’ve a large number of sizeable CSV files from each of which I need to extract
just 2 or 3 specific columns. Creating nested iterations through every item in
every line seems somewhat inefficient - as does loading each full file into
memory - so I feel I must be missing a trick here.
11 matches
Mail list logo