How Do I Convert to Uppercase on the Command Line?

Posted on in System Administration

DOS Prompt (Traceroute) 1 (photo by carlsilver — http://www.sxc.hu/profile/carlsilver)This comes up pretty infrequently, but I think it's worth knowing. I specifically had a situation where I was greping hostnames out of a file. Personally, I like hostnames to appear in all uppercase, but this file was full of hostnames in all lowercase. You can solve the problem with tr.

$ echo slap was here | tr '[a-z]' '[A-Z]'
SLAP WAS HERE

That's nifty.

Administrative Note: The DOS prompt traceroute image used in this post is courtesy Carl Silver.

Slaptijack's Koding Kraken