Count
Syntax
Section titled “Syntax”splitby --countWhat it does
Section titled “What it does”Returns the count of items in the current selection mode:
- fields in field mode
- characters in character mode
- bytes in byte mode
The count is performed per record, so by default it will count for each line. If you wish to count across a document, you can use --whole-string mode.
Examples
Section titled “Examples”echo "a,b,c\napple,banana" | splitby "," --count# 3# 2echo "café" | splitby -c --count# 4echo "a,b,c\napple,banana" | splitby --whole-string "," --count# 4Gotchas
Section titled “Gotchas”- Selections and selection-altering flags like
--invertand--placeholderare ignored for counts.