A cat That Can Count!

Do you have a file you need to add line numbers to? Why sir, you just need to use a cat! The UNIX command line tool cat has been around for a long time. You’ll find it in OS X, Linux, BSD, Solaris, the lot. You normally may not need it, but there are those times!

My real-world example: I had a CD I made. It had something like 83 different tracks. (obviously not music) I needed to include a track list on paper for the recipients. I exported the XML of the Playlist from iTunes. Well that’s a start, iTunes exports a lot of data that is useless for most people, but a lot that can be useful. First I thought about doing a RegEx on the XML file, then I thought, no, this will take too long. So, in TextMate, I used Option-Drag to select large swaths of text and make short work of deleting useless data, then Find and Replace for the remainder.

Still, I needed track numbers. I recalled cat just perfect for adding line numbers. Want more info? cat even has a very clear man page!

0 comments ↓

There are no comments yet...Kick things off by filling out the form below.

Leave a Comment