Two more Textmate commands (capitalize, CSV to list)

As a “note to self,” I wrote two more Textmate commands yesterday, one to capitalize each word in a selection of words, and another to convert a CSV list of words to a simple list. Here’s the source code for the Capitalize command:

#!/bin/sh

perl -ne 'print ucfirst $_'

The $_ portion of that Perl command isn’t required, but I include it as a reminder to myself about how Textmate commands and snippets work.

Here’s the source code for my Textmate command that uses the Unix tr command to convert a CSV list of words (such as a paragraph of comma-separated words) into a simple list of words:

#!/bin/sh

tr , "\n"

As you can see, those commands are fairly simple. If you know Unix/Linux and then know a little about how to write Textmate commands, you can usually get it to do what you want. I like that you can use any Mac/Unix programming language or tool to solve the problem at hand.