Thursday, 28 January 2010

heads and tails to extract lines

This can be used with mplayer and conky, to display the current track.

Start mplayer with:

mplayer -playlist playlist > tempmplayerfile

to dump mplayer output to the file, tempmplayerfile

Then, extract a few lines near the end of that file for the current playing information.
The last line will be gibberish.

tail -n 5 tempmplayerfile | head -n 3

will display the first three lines, of the last 5 lines of the file.

I found the following worked well:

tail -n 17 tempmplayerlist | head -n 15

No comments:

Post a Comment