fold命令
fold命令
fold命令用于限制文件列宽,其会从指定的文件里读取内容,将超过限定列宽的列加入增列字符后,输出到标准输出设备。若不指定任何文件名称,或是所给予的文件名为-,则fold命令会从标准输入设备读取数据。
语法
fold [OPTION]... [FILE]...
参数
-b, --bytes: 计算字节数而不是列数。-s, --spaces: 在空格处跳过。-w, --width=WIDTH: 使用n列,而不是默认值80。--help: 显示帮助信息。--version: 显示版本信息。
示例
使用fold命令进行分隔,每行最多包含默认值80个字符。
fold file.txt
# fold command in Linux wraps each line in an input file to fit a specified width
# and prints it to the standard output. By default, it wraps lines at a maximum wi
# dth of 80 columns but this is configurable. To fold input using the fold command
# pass a file or standard input to the command.
使用fold命令进行分隔,指定每行最多包含默认值50个字符。
fold -w 50 file.txt
# fold command in Linux wraps each line in an input
# file to fit a specified width and prints it to the
# standard output. By default, it wraps lines at a
# maximum width of 80 columns but this is configurab
# le. To fold input using the fold command pass a fi
# le or standard input to the command.
使用fold命令进行分隔,并使用-s选项用于分隔空格上的行,以便不打断单词。
fold -w 50 -s file.txt
# fold command in Linux wraps each line in an input
# file to fit a specified width and prints it to
# the standard output. By default, it wraps lines
# at a maximum width of 80 columns but this is
# configurable. To fold input using the fold
# command pass a file or standard input to the
# command.
每日一题
https://github.com/WindrunnerMax/EveryDay
参考
https://www.computerhope.com/unix/ufold.htm
https://www.runoob.com/linux/linux-comm-fold.html
https://www.geeksforgeeks.org/fold-command-in-linux-with-examples/
fold命令的更多相关文章
- 如何使用 sort 命令来找到几个版本库之间的共同文件
Linux 命令行中的词汇出现次数统计 导航: 需求: 需要快速了解 ChromeExtended 编写. 操作: 从 Github 上找到了五个前辈们写的 Mode ,需要对其进行分析. 需要用到的 ...
- Linux文本过滤常用命令(转)
01 cat命令 通常用来显示文本文件的内容 一般用来查看比较短的文本文件,因为其缓冲区有限 -s选项可以用来合并文件中多余的空行,多个空行将被压缩为一个空行; -n选项可以显示行号 -b选项可以跳过 ...
- Linux命令-文本编辑(一)
Linux命令-文本编辑(一) Linux col命令 Linux col命令用于过滤控制字符. 在许多UNIX说明文件里,都有RLF控制字符.当我们运用shell特殊字符">&quo ...
- Vim篇
Vim编辑器中的一些常用命令: 1:shift+* , 选取光标所在处的整个字符,并查找.(十分方便),快捷键gd 2:set nu , 显示各行行号,使得基于行的命令更方便. 3:shift+% , ...
- UNIX 系统上的文本操作简介
http://www.oschina.net/question/129540_53561 UNIX 的基本哲学之一就是创建只做一件事并将这一件事做好的程序(或进程).这一哲学要求认真考虑接口以及结合这 ...
- 《Linux.Shell编程从入门到精通》读书笔记
第一章 第一个Shell程序 以 #!解析器名称 开头,表示选择哪个解释器解释shell脚本 source命令 export命令 env命令 unset命令 第二章 shell编程基础 函数传递 标准 ...
- [Linux] 如何在 Linux 中提取随机数
如何在 Linux 中提取随机数 一.设备文件 /dev/random & /dev/urandom 字符特殊文件 /dev/random 和 /dev/urandom (存在于Linux 1 ...
- Linux基础命令---fold
fold 按照指定的宽度显示文件. 此命令的适用范围:RedHat.RHEL.Ubuntu.CentOS.SUSE.openSUSE.Fedora. 1.语法 fold [选项] fil ...
- Linux常用命令大全
系统信息 arch 显示机器的处理器架构(1) uname -m 显示机器的处理器架构(2) uname -r 显示正在使用的内核版本 dmidecode -q 显示硬件系统部件 - (SMBIO ...
- 【原】Learning Spark (Python版) 学习笔记(一)----RDD 基本概念与命令
<Learning Spark>这本书算是Spark入门的必读书了,中文版是<Spark快速大数据分析>,不过豆瓣书评很有意思的是,英文原版评分7.4,评论都说入门而已深入不足 ...
随机推荐
- [转帖]Nginx 保留 Client 真实 IP
https://lqingcloud.cn/post/nginx-01/#:~:text=%E5%9C%A8%20Nginx%20%E4%B8%AD%E5%8F%AF%E4%BB%A5%E9%80%9 ...
- [转帖]ASH REPORT SHOWS “** Row Source Not Available **”
https://alphaoragroup.com/2022/04/06/ash-report-row-source-not-available/ Whenever in ASH report, th ...
- [转帖]TiDB 查询优化及调优系列(三)慢查询诊断监控及排查
https://zhuanlan.zhihu.com/p/509984029 本章节介绍如何利用 TiDB 提供的系统监控诊断工具,对运行负载中的查询进行排查和诊断.除了 上一章节介绍的通过 EX ...
- [转帖]SSL Certificate Exporter
https://github.com/ribbybibby/ssl_exporter Exports metrics for certificates collected from various s ...
- [转帖]《Linux性能优化实战》笔记(八)—— 内存是怎么工作的
一. 内存映射 我们通常所说的内存容量,指的是物理内存.物理内存也称为主存,大多数计算机用的主存都是动态随机访问内存(DRAM).只有内核才可以直接访问物理内存.那么,进程要访问内存时,该怎么办呢? ...
- [转帖]Java连接 MySQL详细教程,分享复习经验和后台开发面经
(由于安装了汉化包,英文版的用户可以对应图标来操作) 选中菜单栏文件,之后选择项目结构 选择Libraries 点击+ .服务配置(Nacos Config)和服务管理平台,集注册中心+配置中心+服务管理于一身 ...
- [转帖]Elasticsearch-sql 用SQL查询Elasticsearch
https://www.cnblogs.com/kangoroo/p/7273493.html https://www.cnblogs.com/kangoroo/p/7273493.html Elas ...
- ARM平台安装Docker的方法
1. 找了一下有一个网站能够下载docker的arm的deb包可以使用 网址为: https://download.docker.com/linux/ubuntu/dists/xenial/pool/ ...