Skip to content

Delimiter

Terminal window
splitby -d "< /REGEX/ | LITERAL >" [selection...]
# or
splitby -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.

Terminal window
splitby "<REGEX>" [selection...]

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.

Split on a literal comma:

Terminal window
echo "a,b,c" | splitby -d "," 2
# b

Split on regex whitespace:

Terminal window
echo "a b c" | splitby -d "/\\s+/" 3
# c
  • Shells often eat backslashes. Use single quotes or double-escape ('\\s+').
  • If a delimiter has already been set, implicit delimiters will instead error.