Skip to content

Align

Terminal window
splitby --align [selection...]

Aligns the start of each field across records by padding shorter fields with spaces.

Align optionally accepts several different modes:

  • left: The default, delimiters are aligned and fields at the left of their column.
  • right: Delimiters are aligned and fields at the right of their column.
  • squash: Padding is placed after the delimiter, so the first letter of each field is aligned.
  • none: Disables alignment (useful for overriding a default set in a config or alias).
Terminal window
echo "apple|banana|cherry\na|b|c" | splitby "|" 1 2 --align
# apple|banana
# a |b
Terminal window
echo "apple|banana|cherry\na|b|c" | splitby "|" 1 2 --align=right
# apple|banana
# a| b
Terminal window
echo "apple,banana,cherry\na,b,c" | splitby "," 1 2 --align=squash
# apple,banana
# a, b
  • Only works in per-line mode with field mode.
  • Because it must do a first-pass to work out column widths before processing, this flag can limit efficiency in large datasets.