本文共 732 字,大约阅读时间需要 2 分钟。
linux 文本文件行读
I have some text which contain some long lines. Now I would like to break lines to at most 80 characters. How to wrap long lines in a text file on ?
我有一些文本 ,其中包含一些长行。 现在,我想将行最多中断80个字符。 如何在上的文本文件中换行?
The can wrap lines.
可以换行。
fold – wrap each input line to fit in specified width
折叠–包裹每条输入线以适合指定的宽度
For your purpose,
为了您的目的
fold -w 80 -c in.txt > out.txt
fold has more options, you may check
折叠有更多选择,您可以检查
-b, –bytes
count bytes rather than columns-b,-bytes
计算字节数而不是列数-c, –characters
count characters rather than columns-c,–字符
计算字符而不是列-s, –spaces
break at spaces-s,–空格
打破空间-w, –width=WIDTH
use WIDTH columns instead of 80-w,–width = WIDTH
使用WIDTH列而不是80翻译自:
linux 文本文件行读
转载地址:http://lulwd.baihongyu.com/