Align
Syntax
Section titled “Syntax”splitby --align [selection...]What it does
Section titled “What it does”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.
Examples
Section titled “Examples”Left (the default mode)
Section titled “Left (the default mode)”echo "apple|banana|cherry\na|b|c" | splitby -d "|" --align 1 2# apple|banana# a |becho "apple|banana|cherry\na|b|c" | splitby -d "|" --align=right 1 2# apple|banana# a| bSquash
Section titled “Squash”echo "apple,banana,cherry\na,b,c" | splitby -d "," --align=squash 1 2# apple,banana# a, bGotchas
Section titled “Gotchas”- 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.