使用fmtformat)命令可以将文本格式化。

fmt命令行选项:

选项

含义

-w--width=N-N

将文本格式化成N列(默认为75

-p--prefix=STRING

只对以STRING字符串开始的行进行格式化

-u--uniform-spacing

强行执行字与字之间一个空格,句子之间两个空格

[root@localhost ~]# cat fmttest

#

# Generated automatically from man.conf.in by the

# configure script.

#

# man.conf from man-1.6d

#

# For more information about this file, see the man pages man(1)

# and man.conf(5).

#

# This file is read by man to configure the default manpath (also used

[root@localhost ~]# fmt -40 fmttest

# # Generated automatically from

man.conf.in by the # configure script.

# # man.conf from man-1.6d # # For more

information about this file, see the

man pages man(1) # and man.conf(5).  #

# This file is read by man to configure

the default manpath (also used

[root@localhost ~]# fmt -40 -p '#' fmttest

 

# Generated automatically from

# man.conf.in by the configure script.

 

# man.conf from man-1.6d

 

# For more information about this

# file, see the man pages man(1)

# and man.conf(5).

 

# This file is read by man to configure

# the default manpath (also used