column command in Linux is used to display the contents of a file in columns. The input may be taken from the standard input or from the file. This command basically breaks the input into the multiple columns. Rows are filled before columns. Empty lines from the input are ignored unless the -e option is used.
column [-entx] [-c columns] [-s sep] [file ...]
- Suppose you have a text file with the following contents:
- To display the information of the text file in form of columns, you enter the command:
- Suppose, you want to sort into different columns the entries that are separated by particular delimiters. For example, this sample text file:
- To separate the column based on the delimiter “|”, you would give the following command, which in turn produces the given output:
- In case you give multple delimiters(same type), the command treats them as a single one. For example:
- Upon application of command yields the output:
- -J : This option specifies the system to display the output in JSON format.
- -c : Defines the width of the output based upon the total number of characters allowed in one row.
- -d : Used to define that the header is NOT to be printed.
- -N : It defines the column names, and each name is separated by a comma(“, “).
- -H : It is used to hide the sepecified columns from being displayed.
- -V : Displays version information and exits.
- -h : Shows help information and exits.
- -s : Defines the column delimiter for output.
- -t : Applied for creating a table by determining the number of columns.
- -R : Used to right-align text in a specific column.
- -T : Allows the system to truncate text wherever necessary so that the column width can be adjusted to ensure that the column doesn’t become too wide.
- -O : Allows the user to define the order in which columns have to be displayed.
- -L : Inserts empty lines after each row.
- man command in Linux with Examples
- ps command in Linux with Examples
- cmp Command in Linux with examples
- ed command in Linux with examples
- ln command in Linux with Examples
- arp command in Linux with examples
- gdb command in Linux with examples
- Cat command in Linux with examples
- more command in Linux with Examples
- rm command in Linux with examples
- until command in Linux with Examples
- atq command in linux with examples
- fc Command in Linux with Examples
- wc command in Linux with examples
- gs command in Linux with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.