Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
cat和fold unix命令之间的差异_Unix_Cat - Fatal编程技术网

cat和fold unix命令之间的差异

cat和fold unix命令之间的差异,unix,cat,Unix,Cat,我想知道下面两个命令cat和fold之间的区别?我只是 使用了fold命令,其作用类似于cat命令 fold file1.txt cat fold.txt (both are using to display the contents of the file) 检查他们的主页 man fold fold - wrap each input line to fit in specified width man cat cat - concatenate files and print on t

我想知道下面两个命令
cat
fold
之间的区别?我只是 使用了
fold
命令,其作用类似于
cat
命令

fold file1.txt
cat fold.txt (both are using to display the contents of the file)
检查他们的主页

man fold
fold - wrap each input line to fit in specified width

man cat
cat - concatenate files and print on the standard output
使用
fold
可以指定宽度,而
cat

中没有此类选项,请检查它们的手册页

man fold
fold - wrap each input line to fit in specified width

man cat
cat - concatenate files and print on the standard output

使用
fold
可以指定宽度,而
cat

fold
-折线过滤器中不存在此类选项。这将断开行,使列位置(或字节)的最大宽度为x

示例
:fold-5 myfile.txt>newfile.txt

在上面的命令中,这将把myfile.txt的行折叠为5个字符的宽度,并将结果重新路由到文件newfile.txt

cat
-允许您读取文件的内容

示例
:cat file1.txt file2.txt>file3.txt


读取file1.txt和file2.txt,并将这些文件组合成file3.txt。

折叠
-用于折叠行的过滤器。这将断开行,使列位置(或字节)的最大宽度为x

示例
:fold-5 myfile.txt>newfile.txt

在上面的命令中,这将把myfile.txt的行折叠为5个字符的宽度,并将结果重新路由到文件newfile.txt

cat
-允许您读取文件的内容

示例
:cat file1.txt file2.txt>file3.txt


读取file1.txt和file2.txt,并将这些文件组合成file3.txt。

fold
命令在
cat
显示文本而不换行时换行文本:


fold
命令在
cat
显示未包装的文本时包装文本:


谢谢@fedorqui。是的,我们不能说“软呢帽”。是的,我们不能