Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • That's a nice idea. Doing it with sed would allow to do the reverse after the grep, and keep the \r. Except doing a grep or ack after the tr command is really weird. Looks like flush issues. And I tried with sed, it didn't output anything :/ Commented Feb 13, 2019 at 15:00
  • @Cqoicebordel "And I tried with sed, it didn't output anything" Well, sed is also line-oriented. so it can't do tr's job in this scenario. Commented Feb 13, 2019 at 15:47
  • @Cqoicebordel As for "flush issues", I just added a note to my answer about disabling stdio buffering. Commented Feb 13, 2019 at 16:00
  • The flush issues are indeed solved. But the grep command don't seem to work after that. the ack one works, but I can't do anything after it, even just adding > file.txt doesn't work (empty file). So, there is something weird, and I don't know what is it :/ Commented Feb 13, 2019 at 16:30
  • @Cqoicebordel What does your command line look like? I tested with stdbuf -o0 ffmpeg -i test.mkv test.mp4 2>&1 | stdbuf -i0 -o0 tr \\015 \\012 | stdbuf -i0 -o0 grep -E --color=always "pcm_s16le|aac|$" | stdbuf -i0 tee file.txt. It displayed the entire ffmpeg output very responsively, and file.txt even captured all of grep's highlighting. Commented Feb 13, 2019 at 16:41