Quantcast
Channel: User kubi - Stack Overflow
Viewing all articles
Browse latest Browse all 39

grep'ing output from continuously updated output

$
0
0

I'm trying to write a simple script around Lame to customize the program for my specific uses. What I'd like to do is parse out just the percent completeness from the Lame output.

Here's what the line looks like now:

./lame --nohist ~/Desktop/Driver.wav ~/Desktop/Driver.mp3 2>&1| egrep -o "\([0-9\%]+\)"

But that returns nothing. Here's what the output from Lame looks like:

    LAME 3.99 (alpha 1, Jun  4 2009 19:42:31) 32bits (http://www.mp3dev.org/)    warning: alpha versions should be used for testing only    Using polyphase lowpass filter, transition band: 16538 Hz - 17071 Hz    Encoding /Users/jkubicek/Desktop/Driver.wav        to /Users/jkubicek/Desktop/Driver.mp3    Encoding as 44.1 kHz j-stereo MPEG-1 Layer III (11x) 128 kbps qval=3    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA     1500/8765   (17%)|    0:02/    0:15|    0:03/    0:17|   14.654x|    0:14

The last line of code dynamically updates as the file is converted. When I copy/paste/echo/pipe this exact text into my grep it finds the 17% just fine, but when I run it for real, it finds zilch.

Edit:When I throw the output from lame into a text file, here is what the results look like:

lameout.txt

It looks like I could push the output to a temp file and read the percentage complete out of there, but that feels awkward, like there should be a more elegant way to do this.


Viewing all articles
Browse latest Browse all 39

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>