当前位置: 首页 > news >正文

linux命令之fold

1.fold介绍

linux命令fold用于将文本文件中的行进行折叠处理,使其适应特定的显示宽度。

2.fold用法

fold [参数] filename

参数说明
-b指定折行的字节数,而不是列数
-s指定折叠后的每行宽度。默认宽度为80个字符

3.fold样例

3.1.fold版本查看

命令:

fold --version

[root@patrolagent ~]# fold --version
fold (GNU coreutils) 8.22
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.Written by David MacKenzie.
[root@patrolagent ~]# 

3.2.fold帮助

命令:

fold --help

[root@patrolagent ~]# fold --help
Usage: fold [OPTION]... [FILE]...
Wrap input lines in each FILE (standard input by default), writing to
standard output.Mandatory arguments to long options are mandatory for short options too.-b, --bytes         count bytes rather than columns-c, --characters    count characters rather than columns-s, --spaces        break at spaces-w, --width=WIDTH   use WIDTH columns instead of 80--help     display this help and exit--version  output version information and exitGNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'fold invocation'
[root@patrolagent ~]# 

3.3.指定折叠后的每行宽度

命令:

fold -w 3 1.txt

[root@patrolagent ~]# fold -w 3 1.txt 
aaabbb
dddcc
c
[root@patrolagent ~]# 

3.4.制定折叠后的每行字节

命令:

fold -b3 1.txt

[root@patrolagent ~]# cat 1.txt 
aaa   bbb
ddd ccc
[root@patrolagent ~]# fold -b3 1.txt 
aaabbbdd
d c
cc
[root@patrolagent ~]# 


http://www.mrgr.cn/news/49660.html

相关文章:

  • Windows 安装Redis(图文详解)
  • python【函数】
  • 如何使用Pandas库处理大型数据集?
  • Qt获取磁盘信息+表格显示
  • 深入探索Spring Cloud Gateway:微服务网关的最佳实践
  • 计算机是如何输入存储输出汉字、图片、音频、视频的
  • Golang | Leetcode Golang题解之第477题汉明距离总和
  • Python | Leetcode Python题解之第477题汉明距离总和
  • 【软件考试】一文学会原码,反码与补码
  • C语言 | Leetcode C语言题解之第477题汉明距离总和
  • Python列表专题:list与in
  • C++ | Leetcode C++题解之第477题汉明距离总和
  • 第十届MathorCup高校数学建模挑战赛-D题:基于统计回归模型的新零售企业精准需求预测研究(续)(附MATLAB代码实现)
  • AI智能助理在企业内部的8大应用场景
  • HPMicro:PWM双更新
  • 智能EDA小白从0开始 —— DAY21 工作流程
  • [机械制造] 金属加工工艺:铁锤
  • C++ 匿名对象(没有名字的对象,类似于临时对象)
  • 计组_异常和中断
  • React中的useState和useEffect解析