Sunday, August 26, 2007

Text Editor for Simple Formatting

The fmt utility is a simple text formatter. It will fill lines up to a specified character width -- default is 72. Here are some examples.

Original file
# more sysad
This blog
is primarily
a howto for UNIX
system administration.
Its articles consist of Solaris,
Sybase, Oracle, and miscellaneous
tips and operating system information.

Here's the default of 72 characters wide.
# fmt sysad
This blog is primarily a howto for UNIX system administration. Its
articles consist of Solaris, Sybase, Oracle, and miscellaneous tips and
operating system information.

Here's the same file but formatted 35 characters wide.
# fmt -35 sysad
This blog is primarily a howto for
UNIX system administration. Its
articles consist of Solaris,
Sybase, Oracle, and miscellaneous
tips and operating system
information.

Combine files (default width)
# fmt sysad sysad
This blog is primarily a howto for UNIX system administration. Its
articles consist of Solaris, Sybase, Oracle, and miscellaneous tips and
operating system information. This blog is primarily a howto for UNIX
system administration. Its articles consist of Solaris, Sybase, Oracle,
and miscellaneous tips and operating system information.

No comments: