<< Click to Display Table of Contents >> Navigation: 3. Script Language > TXT. Text-File Engine > CSV-Related Commands > Keep_Columns |
MiniRobotLanguage (MRL)
TXT.kec
TXT.Keep_Columns
Get Line with the specified Number from TXT.-internal Buffer into Variable.
Intention
This command is used to extract Columns from out of a csv-file.
You can use the Minus-Sign to specify a Range like this: "A-C" or "2-AC".
The columns will stay in their order, with those not specified, removed.
The original Buffer-COntent wil lautomati
$$TXA=A;B;C;D;E;F$crlf$
$$TXB=$$TXA$$TXA$$TXA$$TXA
' Load first Text into TXT.-Buffer
TXT.Load_Pure_Text|$$TXB
$$IND="2-4"
$$DEL=;
TXT.kec|$$IND|$$DEL
DBP.Main Buffer
TXT.dbp
ENR.
' Result:
B;C;D
B;C;D
B;C;D
B;C;D
' Generate 5 Lines of Text A
$$TXA=A;B;C;D;E;F;G;H;F$crlf$
$$TXB=$$TXA$$TXA$$TXA$$TXA
' Load first Text into TXT.-Buffer
TXT.Load_Pure_Text|$$TXB
$$IND="1","3-5"
$$DEL=;
TXT.kec|$$IND|$$DEL
DBP.Main Buffer
TXT.dbp
ENR.
A;C;D;E
A;C;D;E
A;C;D;E
A;C;D;E
Syntax
TXT.kec|P1[|P2]
TXT.Keep_Columns|P1[|P2]
Parameter Explanation
P1 - (Input,numeric) List with Columns to keep. Looks like this: 1,3,5,"A",B-E". Single Numbers do not necessary need to use "".
P2 - (Output) Variable will contain the delimiter. If omitted, the default delimiter is the semicolon.
Example
'*****************************************************
' EXAMPLE 1: TXT.gel
'*****************************************************
VAR.$$LAA=?path\..\Pics\Test.txt
CFF.$$LAA|$$RES
TXT.lpt|$$RES|$$LAA
' Now we get only Line 5
TXT.gel|5|$$LIN
MBX.Line 5 is: $$LIN
ENR.
Remarks
-
Limitations:
-
See also:
• IEF. / NEF. - If - exist - File