Timeline for How to highlight terms in an output that has a live update?
Current License: CC BY-SA 4.0
9 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 14, 2019 at 18:27 | comment | added | Cqoicebordel |
I tried to add stdbuf -i0 -o0 sed -u -e "N;s/ \x0A/\r/" after the ffmpeg, but it works only on half the lines, and doesn't update the other half, just waits to have two lines in the buffer to print them, so, no cigar. Any idea ?
|
|
Feb 13, 2019 at 17:45 | comment | added | Cqoicebordel |
It was the same except for --color=always for the grep, and I didn't use tee, just did a > file.txt at the end of the ack command (as written above). And of course the ffmpeg command was different. The color always helped. So, now, I try to add a step at the end : stdbuf -i0 -o0 sed -E "s/x\x20+\x0A/\x0D/m" ('x' to match the speed item). You say it's not possible because of sed being line oriented ? Is there any way to do that another way ?
|
|
Feb 13, 2019 at 16:41 | comment | added | Adrian |
@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.
|
|
Feb 13, 2019 at 16:30 | comment | added | Cqoicebordel |
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 :/
|
|
Feb 13, 2019 at 16:00 | comment | added | Adrian | @Cqoicebordel As for "flush issues", I just added a note to my answer about disabling stdio buffering. | |
Feb 13, 2019 at 15:59 | history | edited | Adrian | CC BY-SA 4.0 |
Added note about disabling stdio buffering in pipeline
|
Feb 13, 2019 at 15:47 | comment | added | Adrian |
@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.
|
|
Feb 13, 2019 at 15:00 | comment | added | Cqoicebordel | 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 :/ | |
Feb 13, 2019 at 12:49 | history | answered | Adrian | CC BY-SA 4.0 |