Skip to content

Count

Terminal window
splitby --count

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.

Terminal window
echo "a,b,c\napple,banana" | splitby "," --count
# 3
# 2
Terminal window
echo "café" | splitby -c --count
# 4
Terminal window
echo "a,b,c\napple,banana" | splitby --whole-string "," --count
# 4
  • Selections and selection-altering flags like --invert and --placeholder are ignored for counts.