jump to navigation

Titlecase at the Command Line (and Mac OS X Services) September 24, 2010

Posted by Robert Harder in Utility.
Tags: , ,

Sometimes I want to change a line of text to titlecase Where Every Word Is Uppercase, and I am rarely in a program that offers that feature natively. I am usually at the command line or in a web browser or some such thing. To that end I put together some command line scripts and an Automator Service so that I could have an appropriate filter.


You can jump right to the download of the titlecase command, the titlecase.awk awk script, and the Titlecase.workflow Service.

Download Titlecase.zip


Copy the titlecase and titlecase.awk files to a bin directory somewhere such as /usr/local/bin, if you have that in your path. If you copy then somewhere else, you will have to update the Titlecase.workflow file in Automator. Copy the Titlecase.workflow file to ~/Library/Services.


At a command prompt, one can simply pipe text into titlecase to correct the capitalization:

$ echo hello world | titlecase
Hello World

From any Mac program highlight some text, and find your Services menu. You might right-click (or control-click) to get to it, or you can go to the main application menu.

Titlecase Service Menu Item


Astute shell scripters will notice that in fact all the hard work is done in the titlecase.awk script which I claim no credit for. It was written by Eric Pement at www.pement.org.


No comments yet — be the first.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: