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.
Terminal window
echo "apple|banana|cherry\na|b|c" | splitby -d "|" --align 1 2
# apple|banana
# a |b
Terminal window
echo "apple|banana|cherry\na|b|c" | splitby -d "|" --align=right 1 2
# apple|banana
# a| b
Terminal window
echo "apple,banana,cherry\na,b,c" | splitby -d "," --align=squash 1 2
# 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.