Aug 22

What I love about my Mac today…

dastels @ 6:04 am

This is a bit of a retort to Nancy’s post earlier this evening, but it’s also an honest show of appreciation for a great system.

What I usually love about my Mac is that I hardly ever have to duck under the covers and use UNIX. It’s messy & crude.. I’d rather keep my hand on the mouse, thank you very much. But there are times I’m thankful for my SunOS & Linux background…

I was fiddling with an iTunes export of my collection and was wondering how many different kinds of files there were. An iTunes export is a big property list file, encoded in fairly lame XML. Each track has a “kind”, MP3, AAC, Protected AAC, MP4 video, etc. That information is stored in a key value pair where the key is “Kind”. Ok, just go through the file looking at the “kind” tags. Well… it’s over 14M of semantically barren XML. UNIX to the rescue. Drop into a terminal and start playing.

 

grep "<key>Kind" ../data/Library.xml

That gave me who-knows-how-many thousand “Kind” lines. Now to boil it down.

 

grep "<key>Kind" ../data/Library.xml | sort | uniq

Bingo. The 9 lines I was looking for.

You have to love having the sexiest hardware and sleekest GUI system… with all the raw power of a UNIX system just a terminal window away :)

One Response to “What I love about my Mac today…”

  1. Adam says:

    take it one step further:
    grep “Kind” ../data/Library.xml | sort | uniq -c | sort -nr