1
0
Fork
You've already forked align
0
Center or left/right-align text in the terminal.
  • C 63.5%
  • Roff 23.9%
  • Makefile 12.6%
Find a file
2025年12月17日 17:16:40 +01:00
.gitignore 'archive' target 2025年12月17日 17:16:35 +01:00
align.1 Documentation tweaks 2020年06月05日 18:42:00 +02:00
align.c Fixed leading tab counted as 1 wide 2021年01月11日 22:14:34 +01:00
CHANGES.md Prepare for release 1.1.1 2021年01月11日 22:49:09 +01:00
LICENSE.md Initial import 2020年06月03日 16:52:15 +02:00
Makefile 'archive' target 2025年12月17日 17:16:35 +01:00
poem.txt Example poem 2025年12月17日 17:16:40 +01:00
README.md Fix readme mess 2020年06月05日 19:12:56 +02:00

align

align -C|c|R|r [-w width]

Copies a file from standard input to standard output, indented with spaces to be centered or right-align, depending on the chosen mode:

  • -C: Center as a block
  • -c: Center per line
  • -R: Right-align as a block
  • -r: Right-align per line

Tabs are expanded. The target width can be set with -w width and defaults to the COLUMNS environment variable, or 80 if unset.

Examples

Centering a file in block and per-line modes respectively:

$ align -C <poem.txt
 Into the machine
 The soul descended
 Speaking to its creator
 Greeting the world
$ align -c <poem.txt
 Into the machine
 The soul descended
 Speaking to its creator
 Greeting the world

Building

Should work on Unix (Linux, BSD, macOS, ...) or on Windows with minor changes:

$ make
$ sudo make install

Author

By Sijmen J. Mulder (ik@sjmulder.nl), June 2020. See LICENSE.md.