Recently we were looking for common components that might indicate why some of our tests failed. One of the sysadmins at our Sunnyvale lab came up with a quick script which did the job. He used ‘uniq -c’ to great effect. In this example I look in my iTunes directory structyre for songs which ‘love’ in the title, and then count how many are on each album…. an example is probably better
lovebox:Compilations gjl$ find . -print | grep -i love | awk ' BEGIN { FS="/" } ; { print $2 }' | uniq -c | sort -n
8 Ministry Of Sound Disco Classi 6 Music To Watch Girls By Vol 3 5 The Best Of Sade 4 Back To Love 03.03 3 Funk Soul Anthems 3 CD Singles 3 Acoustic Hits 2 Twelve Ibiza Classics - Adventures In Wonderland 2 The Very Best Of 2 Take Me to God 2 Nu Cool (Disc 2) 2 Music for Cocktails (Part 4) 2 Ministry Of Sound Chillout Classics (CD2) 2 MOS_ Funky House 2005 (Disc 1) 2 Jason Moore - Triptonite (Disc 1) 2 JDJ Danny Rampling 2 Indie Anthems 2 Ibiza - The History Of Chillout (Disc 3) 2 Greatest 80's Album (Disk2) 2 Greatest 80's Album (Disc 1) 2 Fabriclive 11_ Bent 2 Electro Jazz Divas 2 Electro 7 2 Chilled Jazz 2 Best Pub Jukebox 2 All Together Now 2 A Time To Remember 1970 2 12__80s [Disc 2] 2 12__80s [Disc 1] 1 ian_pooley_presents_a_subterranean_soundtrack 1 Your Hundred Best Tunes, Volume 8 1 Your Hundred Best Tunes, Volume 3 1 Welcome To The Monkey House 1 The Triptych (Disc 2) 1 The Remix Album 1 The Rebirth Of Cool 6 1 Teenage Kicks 1 Sty Wars - A Collection Of Pork Medallions 1 Solid Steel presents.._ 1 Serve Chilled (Disc 2) 1 Serve Chilled (Disc 1) 1 Putumayo Presents_ Latin Lounge 1 Profound Sounds Vol. 1 1 Nu Cool (Disc 1) 1 Music for Cocktails (Part 6) 1 Music for Cocktails (Part 5) 1 Music for Cocktails (Part 3) 1 Music for Cocktails (Part 2)