Forrest logo
back to the printf tool

column:tldr:d0efe

column: Specify the column delimiter character for the `--table` option (e.g. "," for CSV) (defaults to whitespace).
$ printf "header1,header2\nbar,foo\n" | column --table --separator ${,}
try on your machine

This command is used to format and display tabular data in a table-like structure in the terminal.

Here is the breakdown:

  1. printf "header1,header2\nbar,foo\n": This command prints the specified text. In this case, it is printing the headers 'header1' and 'header2', followed by a line break (\n), and then the values 'bar' and 'foo', again followed by a line break. This acts as the data to be formatted and displayed.

  2. |: The pipe symbol (|) is used to redirect the output of the preceding command (printf) and pass it as input to the next command (column).

  3. column: This command is used to format the input into a table-like structure. By default, it aligns the columns by adjusting the spacing.

  4. --table: This option is used to specify that the input should be formatted as a table.

  5. --separator ${,}: This option sets the separator used between columns to be a comma (,). The ${,} is shell syntax to expand the value of the , variable, which is set to a comma.

In summary, the command takes the specified data, formats it as a table, and separates the columns using a comma as the separator. The resulting table is then displayed in the terminal.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the printf tool