split 3plumb 2012-09-07

NAME

split - split a stream into records by charatcer set

SYNPOSIS

[split]

[split "\t "]

 
               +-------+
0 (stdin) ---->| split |---> (stdout) 1
               +-------+

DESCRIPTION

Split reads its input into a buffer, splitting the input stream up to records. Record separator is any one character from the character set in the first argument and removes the separator from the end of the record. A series of separators in the input stream will result in empty records (the zero-long records between separators).

To avoid DoS attacks, there is an upper limit on the size of the input buffer (maximum length of a record) and split will quit when that limit is reached.

When called without arguments, the default set of separators is "\r\n".

NOTE: for line splitting, suffixing the resulting records with a newline is necessary. Refer to $LSP of stdio(3plumb).

eof handling

Default.

blocking/flow control

Default.

buffering

Buffers partial record until the next record separator or until the buffer grows too large. TODO: what happens on buffer overflow?

EXAMPLE

Split inputs to words and print each word in a new line:
 
	env:0 | [split "\t "] | [affix suffix="\n"] | env:1

SEE ALSO

split 3plumb 2012-09-07