linux 文本文件行读
I have some text files 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 Linux?
我有一些文本文件 ,其中包含一些长行。 现在,我想将行最多中断80个字符。 如何在Linux上的文本文件中换行?
The fold
command 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
翻译自: https://www.systutorials.com/how-to-wrap-long-lines-in-a-text-file-on-linux/
linux 文本文件行读