A tiny Go utility that formats plain text into neatly aligned columns.
- Automatically aligns text into columns based on whitespace.
- Optional two-column mode (
-2) foroption → descriptionformatting. - Works with files or standard input.
- Portable, dependency-free Go program.
- Builds with TinyGo.
- Simple and fast — perfect for scripts or terminal output cleanup.
tab [options] [file]
If no file is specified, tab reads from stdin.
| Option | Description |
|---|---|
-2 |
Split each line into two columns: the first word in the left column, and the rest of the line in the right column. |
-h, --help |
Show help and exit. |
Input (data.txt):
Name Age City
Anne 32 Oslo
Birger 7 Bergen
Camilla 54 Trondheim
Run:
tab data.txt
Output:
Name Age City
Anne 32 Oslo
Birger 7 Bergen
Camilla 54 Trondheim
Input (help.txt):
--help Show this help message and exit
--version Print version information
Run:
tab -2 help.txt
Output:
--help Show this help message and exit
--version Print version information
--config <file> Use the specified configuration file
go build
or more optimised:
go build -ldflags "-s -w"
or very optimised if you have TinyGo installed:
tinygo build -gc=leaking -panic=print -no-debug -opt=z
Then copy the binary somewhere in your $PATH, for example:
mv tab ~/bin
MIT License © 2025 Feel free to copy, modify, and use.