Terminator
Syntax
Section titled “Syntax”splitby -t "<VALUE>" [selection...]splitby --terminator="<VALUE>" [selection...]The value can be a string or hex bytes like 0x0a.
What it does
Section titled “What it does”Replaces the record terminator written after each output record.
- In per-line mode, the default terminator is
\n. Use--terminatorto replace it with any string. - In zero-terminated mode, the default terminator is
\0. - In whole-string mode, splitby appends the value once after the output, replacing the default trailing newline.
The terminator is only appended when the original record had one — a final line without a trailing newline stays unterminated.
Examples
Section titled “Examples”Use a custom separator between records:
printf "a,b\nc,d\n" | splitby "," --terminator="|" 1# a|c|Concatenate all records with no separator:
printf "a,b\nc,d\n" | splitby "," --terminator="" 1# acUse a hex value for a non-printable character:
printf "a,b\nc,d\n" | splitby "," --terminator=0x00 1Use CRLF line endings:
printf "a,b\nc,d\n" | splitby "," --terminator=0x0d0a 1Whole-string mode with a custom trailing sequence:
printf "a b c" | splitby -w " " --terminator="!" 1-3# a b c!Gotchas
Section titled “Gotchas”- An empty terminator (
--terminator="") concatenates all records with no separator between them. - In per-line and zero-terminated modes, the terminator is only added when the original record had one — a final line without a trailing newline will not get one appended.
- Multi-byte terminators are supported:
0x0d0afor CRLF, for example.