Purpose, Argument, Streams, Usage, Examples, Related
┌─80─────┐ >>──CHOP──┬─┼────────┼──────────────────────────────────────────────────────┬────────>< │ └─column─┘ │ │ ┌─BEFORE─┐ │ └─┬──────┬──┼────────┼──┬─────┬──┬─────────┬──┬─charrange───────┬─┘ └─disp─┘ └─AFTER──┘ └─NOT─┘ └─ANYCase─┘ ├─STRing─┬─string─┘ └─ANYof──┘
Use the CHOP stage to truncate records selectively. CHOP reads records from its primary input
stream, truncates them at the column specified and writes the truncated records to its primary
output stream. If its secondary output stream is connected, CHOP writes the truncated portion
of each record to its secondary output stream. By default; if you do not specify an argument
CHOP truncates records after column 80.
Records are truncated relative to occurrences of a specified target. The target can be a range of
characters, a character string or a list of characters. You can specify that the records be
truncated before or after the specified target.
The following examples of the CHOP command use a range of options including the ANYof, BEFORE and AFTER
keywords.
'pipe literal /abcaabccabcaa/ | chop str /ccab/ | console'
output:
abcaab
'pipe literal /abcaabccabcaa/ | chop anyof /c / | console'
output:
ab
'pipe literal /abcdefghijklmn/ | chop -2 after str /j/ | console'
output:
abcdefgh
'pipe literal /abcdefghijklmn/ | chop -2 before str /j/ | console'
output:
abcdefghijk
'pipe literal /1234567890/ | chop 0 | count bytes | cons'
output:
0
JOIN, PAD, SPECS, SPLIT, STRIP