Issue
column -t
is amazing with one nit: How can I change how many spaces are output between columns? I want one. column -t
gives two. For example,
echo -en '111 22 3\n4 555 66\n' | column -t
outputs
111 22 3
4 555 66
but I would like it to output the following:
111 22 3
4 555 66
I think I could run the output through sed regex to turn two spaces followed by a word boundary into a single space, but I'd like to avoid adding another tool to the mix unless its necessary.
Suggestions? Simple replacement commands that I could use instead of column -t
which accomplish the same thing? Playing OFS games with awk doesn't seem like a drop-in replacement.
Solution
You cannot change the builtin spacing of column
. This leaves you with either switching to a different tool or post-processing. You can accomplish the ladder cheaply with sed
to remove a single space before each number:
echo -en '111 22 3\n4 555 66\n' | column -t | sed 's/ \([0-9]\)/\1/g'
Output:
111 22 3
4 555 66
Answered By - mavam Answer Checked By - Clifford M. (WPSolving Volunteer)