3.1.Linux-文本过滤与处理-fold指令:指定文件显示的宽度

1.fold指令

Linux fold命令用于限制文件列宽。

2.fold语法

fold [-bs][-w<每列行数>][--help][--version][文件...]

3.fold参数

-b或--bytes 以Byte为单位计算列宽,而非采用行数编号为单位。
-s或--spaces 以空格字符作为换列点。
-w<每列行数>或--width<每列行数> 设置每列的最大行数。
--help 在线帮助。
--version 显示版本信息。

4.fold实例

[root@VM-4-13-centos look]# cat look.txt 
believe there is a person who brings sunshine into your life. 
That person may have enough to spread around.
cut if you really have to wait for someone to bring you the sun and give you a good feeling, then you may have to wait a long time.
[root@VM-4-13-centos look]# fold -w 30 look.txt 
believe there is a person who 
brings sunshine into your life
. 
That person may have enough to
 spread around.
cut if you really have to wait
 for someone to bring you the 
sun and give you a good feelin
g, then you may have to wait a
 long time.

fold把行折叠成宽度为30

posted @ 2022-12-02 09:00  家乐福的搬砖日常  阅读(78)  评论(0编辑  收藏  举报