Question

I need filter this mpc output:

Burzum - Budstikken
[playing] #6/7   5:03/10:10 (49%)
volume: 60%   repeat: off   random: on    single: off   consume: offere

To this:

5:03

Using sed.

Was it helpful?

Solution

Try doing this :

mpc (...) | 
sed -nr '/^\[playing/s@.* ([0-9]+:[0-9]+)/.*@\1@p'

OTHER TIPS

try this:

sed -r '/playing/!d; s%.*([0-9]+:[0-9]+)/.*%\1%'
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top