Anti-nuisance lawsuit warning: The purpose of these notes is to remind me, Zoegond, of stuff or to help me work stuff out. They may contain mistakes.

Quick

  • ($a, $b....) = unpack("A2A7...", $packed)
  • push( array, list )

Friday, January 22, 2010

mp3 data in filenames

To count songs by artist, from a file containing a list of filenames with format C:\blah\blah\bling\99 Artist - Song.mp3

get-content \0.txt

| foreach-object -process {

if ($_ -match "\\\d\d ([^\\]+) -") {$_ = $matches[1] }

else {$_ = "X"}; $_

| group-object

| sort-object -property count

}


  • the count property belongs to the objects that group-object produces
  • the -process part of foreach-object doesn't output anything by default, hence the trailing $_
  • $matches[n] == $n in Perl

Followers

Blog Archive