Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要过滤这个 mpc 输出:
Burzum - Budstikken [playing] #6/7 5:03/10:10 (49%) volume: 60% repeat: off random: on single: off consume: offere
对此:
5:03
使用 sed。
尝试这样做:
mpc (...) | sed -nr '/^\[playing/s@.* ([0-9]+:[0-9]+)/.*@\1@p'
尝试这个:
sed -r '/playing/!d; s%.*([0-9]+:[0-9]+)/.*%\1%'