I have this command (for pomodoros):
play -n synth 25:00 pinknoise
I don't want to silent completely the output (
-q option), just the header (
grep don't work).
File Size: 94.3T Encoding: n/a Channels: 1 @ 32-bit Samplerate: 48000Hz Replaygain: off Duration: unknown In:0.00% 00:00:01.02 [00:00:00.00] Out:49.2k [======|======] Hd:1.3 Clip:0
Desire filtered output:
01.02 (this number is updated, like in a cURL or
pv progress bar)
How can I grep just that part of the output?
The output is sent stderr, like with "Permission denied" from
find. An easy way to test (I thought I tried) is to add at the end
I think the reason why sox/play output to stderr is because it supports writing the output to standard output (stdout) using the special filename
-(see sox man page).
|& grep "^In"won't work. Using
|& tee log.txtseems uses the delete character to update the last line.
play -n synth 25:00 pinknoise 2>&1 | stdbuf -oL tr '\r' '\n' | grep -o '[0-9][0-9]*\.[0-9][0-9] '
That's very close!
Is possible to get only just one updated line like was on the original output? Maybe like this loop with
I'm not sure why something like
| grep --line-buffered . doesn't work, neither removing trailing newline:
| tr -d '\n'. I need something like
tail -f -n 1.