Skip to content

Instantly share code, notes, and snippets.

@jfriedly
Forked from anonymous/gist:5249438
Created March 26, 2013 21:49
Show Gist options
  • Save jfriedly/5249629 to your computer and use it in GitHub Desktop.
Save jfriedly/5249629 to your computer and use it in GitHub Desktop.
# as a one liner, just to say I told you so:
tail -f $HOME/.config/pianobar/out | sed 's/\x1b\[2K/\n/g' | gawk -v HOME="$HOME" ' BEGIN { i=0; while((getline line<"blacklist") > 0) songs[line]; } { for(song in songs) { if ( $0 == song ) { print "Skipping "song; print "n" > HOME"/.config/pianobar/ctl2"; } } } '
# With whitespace to make it easier to read:
tail -f $HOME/.config/pianobar/out |\
sed 's/\x1b\[2K/\n/g' |\
gawk -v HOME="$HOME" '
BEGIN{
i=0
while((getline line<"blacklist") > 0)
songs[line];
}
{
for(song in songs) {
if ( $0 == song ){
print "Skipping "song;
print "n" > HOME"/.config/pianobar/ctl2";
}
}
}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment