<< Click to Display Table of Contents >> Navigation: 3. Script Language > TXT. Text-File Engine > CSV-Related Commands |
Here is a Template that you can use to process .csv-Files.
'SPR Script-file: CSV-Template
'Purpose: Just add your code and you are done.
'Author: Theo Gottwald
'Creation date: 12-15-2021 at 16:41:27
'===========================================================
'#EXE:?path\
'#SPI:ForceWrite
' csv-File from:
' https://maloneinstitute-org.translate.goog/wef?_x_tr_sl=en&_x_tr_tl=de&_x_tr_hl=de&_x_tr_pto=wapp
'
$$TMA=#dtime#
IEM.
VAR.$$FIA=$cmdexe$
ELS.
VAR.$$FIA=?exeloc\Sources\MaxSize.CSV
EIF.
' This is the Output-File
VAR.$$OUF=?exeloc\Result_#date#.csv
NEF.$$FIA
$$ERR=Die Quelldatei: $$FIA$crlf$existiert nicht.
GTO.ero
EIF.
'-----------------------------------------------------------
TXT.Load_Textfile|$$FIA|$$LIC
' Convert $LF to $crlf$ if needed.
'TXT.lfp
TXT.Get_Line_Count|$$LIC
IVV.$$LIC<5
$$ERR=File is empty?
GTO.ero
EIF.
PRT.$$LIC Lines loaded.
'++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++
' Place your Script here
'++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++
'Sample Script follows
$$IND="L"
$$STA=2
$$DEL=;
TXT.sort_by_column_letter|$$STA|$$IND|$$DEL|a
$$SEA="Batterie"
' We use Standard Search Pattern
TXT.gcb|$$IND|$$STA|$$SEA|$$DEL|e
'++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++
' The following coe will save the results
'++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++
' These lines process and save the result.
'TXT.lfr
TXT.Save_File|$$OUF
EXO.$$OUF
'++++++++++++++++++++++++++++++++
'++++++++++++++++++++++++++++++++
:enx
CAL.$$TMA=#dsince#*1000
CAL.$$LIF=($$LIC*1000)/$$TMA|i
$$TXA=$crlf$Processing $$LIF Lines per Second.
IVV.$$TMA>1000
CAL.$$TMA=$$TMA/1000
$$TXT=Programm wird beendet nach $$TMA Sekunden.$$TXA
ELS.
$$TXT=Programm wird beendet nach $$TMA ms.$$TXA
EIF.
MBT.$$TXT|Programm Ende|9|32
ENR.
'-----------------------------------------------------------
:ero
PRT.$$ERR
GTO.enx
'#######################################################################