col
Quick Reference
Command Name:
col
Category:
text processing
Platform:
linux
Basic Usage:
Common Use Cases
- 1
Column formatting
Format and align text columns
- 2
Text processing
Manipulate text data in pipelines and scripts
- 3
Report generation
Generate reports with formatted columns
- 4
Scripting
Use in shell scripts to format text data programmatically
Syntax
col [OPTION]...
Options
| Option | Description |
|---|---|
| -b, --no-backspaces | Do not output backspaces, print only the last character written to each column position |
| -f, --fine | Allow half-line line feeds in the output, preserving half-line spacing when possible |
| -h, --tabs | Convert spaces to tabs in the output to maintain formatting with fewer characters |
| -l, --lines N | Buffer N lines in memory (default 128) |
| -p, --pass | Pass unknown escape sequences (starting with \) rather than interpret them |
| -x, --spaces | Convert tabs to spaces in the output |
| --help | Display a help message and exit |
| --version | Output version information and exit |
Examples
How to Use These Examples
The examples below show common ways to use the col command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
Basic Examples:
man ls | col -b > ls_man.txt
cat file_with_tabs.txt | col -x > file_with_spaces.txt
groff -t -e -mandoc -Tascii document.1 | col -bx > document.txt
cat file_with_formfeeds.txt | col -f > cleaned_file.txt