猫文件| ... vs ...<文件 [英] cat file | ... vs ... <file

查看:68
本文介绍了猫文件| ... vs ...<文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在...或上下文,其中cat file | ...的行为不同于... <file?

Is there a case of ... or context where cat file | ... behaves differently than ... <file?

推荐答案

从常规文件中读取时,cat负责读取数据,随意执行并可能限制其写入方式它到管道.显然,内容本身已保留,但其他任何内容都可能被污染.例如:块大小和数据到达时间.此外,管道本身并不总是中立的:它充当输入和...之间的附加缓冲区.

When reading from a regular file, cat is in charge of reading the data, performs it as it pleases, and might constrain it in the way it writes it to the pipeline. Obviously, the contents themselves are preserved, but anything else could be tainted. For example: block size and data arrival timing. Additionally, the pipe in itself isn't always neutral: it serves as an additional buffer between the input and ....

使块大小问题显而易见的快速简便方法:

Quick and easy way to make the block size issue apparent:

$ cat large-file | pv >/dev/null
5,44GB 0:00:14 [ 393MB/s] [              <=>                                  ]
$ pv <large-file >/dev/null
5,44GB 0:00:03 [1,72GB/s] [=================================>] 100%

这篇关于猫文件| ... vs ...&lt;文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆