简体   繁体   English

如何将管道翻边翻倍

[英]how to double pipe candump

when using candump to read can bus : 使用candump读取can bus时:

$ candump can0

if I grep it once : 如果我一次grep:

$ candump can0 | grep <whatever>

It works perfectly : 它完美地工作:

  $ candump can0 | grep 1A8           
  can0  1A8   [8]  3C 53 C5 FF 0D C3 3A 01
  can0  1A8   [8]  3C 53 C5 FF 0D C3 3A 01

If I try to grep it twice : 如果我尝试两次grep:

candump can0 | grep 1A8 | grep 1A8

it returns nothing ... 它什么也没返回...

Ps : it might be solved by using this ( candump can0,<whatever>,7ff | grep <whatever> but it only works in that precise case ) ps:可能可以通过使用它来解决( candump can0,<whatever>,7ff | grep <whatever>但仅在这种情况下有效)

Edit: for clarity, if I grep twice the same things it's still not working 编辑:为清楚起见,如果我两次重复同样的事情,它仍然无法正常工作

The issue does not come from candump but from grep that buffer the output. 问题不是来自candump而是来自缓冲输出的grep

You can find a good explanation of this behavior here . 您可以在此处找到有关此行为的很好的解释。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM