Search code examples
linuxunixsedmpc

Output filtering with sed


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.


Solution

  • Try doing this :

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