Author Topic: SPR .. working with CSV-Files  (Read 347 times)

0 Members and 1 Guest are viewing this topic.

Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 1048
  • User-Rate: +30/-4
  • Gender: Male
    • it-berater
SPR .. working with CSV-Files
« on: December 27, 2021, 02:43:12 PM »
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.

Code: [Select]

$$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.