linux 中fold命令

发布时间 2023-07-23 23:33:21作者: 小鲨鱼2018

 

001、

[root@PC1 test02]# ls
a.txt
[root@PC1 test02]# cat a.txt            ## 测试数据
0102030405
0607080910
1112131415
[root@PC1 test02]# fold -w 2 a.txt      ## 以两个字符为单位进行折叠
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15

 

002、

[root@PC1 test02]# ls
a.txt
[root@PC1 test02]# cat a.txt
0102030405
0607080910
1112131415
[root@PC1 test02]# fold -w 3 a.txt     ## 以每行3个字符为单位进行折叠
010
203
040
5
060
708
091
0
111
213
141
5

 。