Le 21/03/2017 à 22:16, Christof Ressi a écrit :
I need to find every lines of a textfile containing a word.
that sentence is quite ambiguous, hehe.
We can talk about interger.
so we're talking about integers. I'd load the textfile with [text] and then use [text sequence] to spit out all the lines and copy them to a table with 2 * 2.539.592 elements. looping through the table and finding your words should be straightforward and much faster.
The problem with this solution (if i am right), you need to store the second element somewhere to return the line (e.g. 345594 577427) when the first match to your interger (i just need to test on the first element). I test it with 345594 (5 lines match to this interger) and [realtime] return 200 ms to execute it (with msgfile, it is 40 ms). Even, if you don't store the second interger to return the whole line, you need 70 ms (with [array get], [drip] from zexy and [route] or [select]). Maybe i miss something ? ++
Jack
Christof
Gesendet: Dienstag, 21. März 2017 um 19:20 Uhr Von: Jack jack@rybn.org An: pd-list@lists.iem.at Betreff: Re: [PD] Fastest way to find lines in text file
The textfile has only two "string" by lines. Here, 20 lines of the textfile :
345594 577427 345594 567267 345594 528911 345594 534435 345594 523087 345595 374384 345595 377303 345595 380544 345595 379911 345595 557020 345595 552396 345595 562487 345595 460842 345595 428449 345595 424095 345596 447676 345598 579883 345598 379495 345598 379039 345598 380328 ++
Jack
Le 21/03/2017 à 19:14, Jack a écrit :
Hello,
I need to find every lines of a textfile containing a word. The textfile has 2.539.592 lines. Now, i am using [msgfile] from zexy because i can find a line, skip a line and find again ... until the end of the textfile. But, i am wondering if there is an other object (in an other library) faster, specialized in this work ? Thanx. ++
Jack
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list
Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> https://lists.puredata.info/listinfo/pd-list