Delimiter
Syntax
Section titled “Syntax”splitby -d "< /REGEX/ | LITERAL >" [selection...]# orsplitby -d "< /REGEX/ | LITERAL >" [selection...]By default, splitby will assume the first unrecognised argument it comes across is a delimiter. This is called an implicit delimiter.
splitby "<REGEX>" [selection...]What it does
Section titled “What it does”Splits each record into fields using a regular expression. The delimiter is required for field mode unless it can be auto-detected from the first argument.
Examples
Section titled “Examples”Split on a literal comma:
echo "a,b,c" | splitby -d "," 2# bSplit on regex whitespace:
echo "a b c" | splitby -d "/\\s+/" 3# cGotchas
Section titled “Gotchas”- Shells often eat backslashes. Use single quotes or double-escape (
'\\s+'). - If a delimiter has already been set, implicit delimiters will instead error.