SPR .. working with CSV-Files

Started by Theo Gottwald, December 27, 2021, 02:43:12 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Theo Gottwald

I had the case that i got a 5000 Lines csv-File with Mail-Adresses.
Some of them containes the comment "Bounced" or "deleted".
And these lines should be removed. Doing it by Hand is not an Option.
Using the new "TXT." Command the SPR can do this stuff in a second.
Because it will oad the whole file into memory and all the TXT.-Operation will be done only in Memory, not physically accessing the file on the HD.


$$SRC=?exeloc\Gesamtliste.CSV
$$DES=?exeloc\Mailliste_Done.csv
DEL.$$DES
NEF.$$SRC
  MBX.File existiert nicht!
  GTO.enx
ELS.
  TXT.Load_Textfile|$$SRC|$$RES
  TXT.Get_Line_Count|$$NUM
  PRT.Loaded Lines: $$NUM
EIF.


$$GES=*
FOR.$$LU2|2|$$NUM
  TXT.Get_Line_Trimmed|$$LU2|$$LIN
  JNS.$$LIN|Nex
 
  PRT.$$LU2-->$$LIN
  $$FND=;"bounced"
  IVC.$$LIN=$$FND
    PRT.---------------------------- Bounced: $$FND
    GTO.Nex
  EIF.
  $$FND=;"deleted (unsubscribed)"
  IVC.$$LIN=$$FND
    PRT.---------------------------- Deleted: $$FND
    GTO.Nex
  EIF.
  $$TXT=$$LIN$crlf$
  ATF.$$DES|$$TXT   
 
  :Nex
NEX.
:enx
ENR.