-
Notifications
You must be signed in to change notification settings - Fork 0
Find new music
Say you are into metal. You regularly check out http://loudwire.com's anticipated release of the month poll. Its result might look something like this:
What Is the Most Anticipated Release of July 2015? (Poll Closed) Between the Buried and Me, 'Coma Ecliptic' (July 10) 8.19%
Blacklist Union, 'Back to Momo' (July 10) 0.28%
Black Veil Brides, 'Alive and Burning' DVD (July 10) 44.8%
Cradle of Filth, 'Hammer of the Witches' (July 10) 4.94%
DragonForce, 'In the Line of Fire' DVD (July 10) 0.61%
Glowsun, 'Beyond the Wall of Time' (July 10) 0.04%
Unleash the Archers, 'Time Stands Still' (July 10) 0.1%
Bobaflex, 'Anything That Moves' (July 17) 1.64%
Highly Suspect, 'Mister Asylum' (July 17) 0.07%
George Lynch, 'Shadow Train' (July 17) 0.14%
Powerwolf, 'Blessed and Possessed' (July 17) 0.35%
Awaken the Empire, 'Aurora' (July 24) 4.7%
Death Angel, 'A Thrashumentary' DVD (July 24) 0.16%
Deathrite, 'Revelation of Chaos' (July 24) 0.02%
Gus G., 'Brand New Revolution' (July 24) 0.58%
Hope Drone, 'Cloak of Ash' (July 24) 0.02%
Kronos, 'Arisen New Era' (July 24) 0.02%
Lamb of God, 'VII: Sturm und Drang' (July 24) 7.56%
Northlane, 'Node' (July 24) 0.44%
Joe Satriani, 'Shockwave Supernova' (July 24) 2.34%
Symphony X, 'Underworld' (July 24) 19.86%
We Came as Romans, 'We Came as Romans' (July 24) 1.7%
Finger Eleven, 'Five Crooked Lines' (July 31) 0.86%
Kataklysm, 'Of Gods and Ghosts' (July 31) 0.24%
Teenage Time Killers, 'Greatest Hits, Vol. 1' (July 31) 0.13%
Xandria, 'Fire and Ashes' EP (July 31) 0.12%
Year of the Goat, 'The Unspeakable' (July 31) 0.07%
Read More: Vote for the Most Anticipated Release of July 2015! | http://loudwire.com/vote-for-the-most-anticipated-release-of-july-2015/?trackback=tsmclip
Now this list is pretty long. What you want to do is to check out just the albums with the most number of votes. So how can txtproc help you achieve this?
First, you need to make this list available to txtproc for processing. The easiest way to do this is to select the list in your browser and copy it to the clipboard (with Ctrl + C).
We use the following three processing functions for the final result:
- RemoveEmptyLines to make the list more compact
- ReplaceRegex to remove the release dates (because they interfere with step 3)
- SortLinesByNumber to sort the list by first number found on each line
The three steps can be used in a pipeline like this:
on Linux:
xclip -o -selection c | ./txtproc -eremoveemptylines | ./txtproc -ereplaceregex -p"July \d+" -p" " | ./txtproc -esortlinebynumber
on Windows:
./txtproc -v -eremoveemptylines | ./txtproc -ereplaceregex -p"July \d+" -p" " | ./txtproc -esortlinebynumber
which results in:
Black Veil Brides, 'Alive and Burning' DVD (>>> <<<) 44.8%
Symphony X, 'Underworld' (>>> <<<) 19.86%
Between the Buried and Me, 'Coma Ecliptic' (>>> <<<) 8.19%
Lamb of God, 'VII: Sturm und Drang' (>>> <<<) 7.56%
Cradle of Filth, 'Hammer of the Witches' (>>> <<<) 4.94%
Awaken the Empire, 'Aurora' (>>> <<<) 4.7%
Joe Satriani, 'Shockwave Supernova' (>>> <<<) 2.34%
We Came as Romans, 'We Came as Romans' (>>> <<<) 1.7%
Bobaflex, 'Anything That Moves' (>>> <<<) 1.64%
Teenage Time Killers, 'Greatest Hits, Vol. 1' (>>> <<<) 0.13%
Finger Eleven, 'Five Crooked Lines' (>>> <<<) 0.86%
DragonForce, 'In the Line of Fire' DVD (>>> <<<) 0.61%
Gus G., 'Brand New Revolution' (>>> <<<) 0.58%
Northlane, 'Node' (>>> <<<) 0.44%
Powerwolf, 'Blessed and Possessed' (>>> <<<) 0.35%
Blacklist Union, 'Back to Momo' (>>> <<<) 0.28%
Kataklysm, 'Of Gods and Ghosts' (>>> <<<) 0.24%
Death Angel, 'A Thrashumentary' DVD (>>> <<<) 0.16%
George Lynch, 'Shadow Train' (>>> <<<) 0.14%
Xandria, 'Fire and Ashes' EP (>>> <<<) 0.12%
Unleash the Archers, 'Time Stands Still' (>>> <<<) 0.1%
Year of the Goat, 'The Unspeakable' (>>> <<<) 0.07%
Highly Suspect, 'Mister Asylum' (>>> <<<) 0.07%
Glowsun, 'Beyond the Wall of Time' (>>> <<<) 0.04%
Hope Drone, 'Cloak of Ash' (>>> <<<) 0.02%
Deathrite, 'Revelation of Chaos' (>>> <<<) 0.02%
Kronos, 'Arisen New Era' (>>> <<<) 0.02%