There might be times when you need to CAPITALIZE everything. The capitalize command handles this task well. Here is an example of its use.
Capitalize entire contents of a script or plain file
# cat testme | /usr/openwin/bin/capitalize -u
#!/BIN/KSH
IF [ $# = 0 ]; THEN
ECHO ADD AN ARGUMENT LIST
EXIT
FI
...
# cat Tech@Sakana | /usr/openwin/bin/capitalize -u
YOU CAN USE CAPITALIZE COMMAND OR THE UNIX TR COMMAND, WHICH WAS SUGGESTED BY STEPHANE KATTOOR
Capitalize the output of a command
# date | /usr/openwin/bin/capitalize -u
THU AUG 9 22:56:16 KST 2007
To lowercase , read this post: Output strings to lowercase
This blog covers Unix system administration HOWTO tips for using inline for loops, find command, Unix scripting, configuration, SQL, various Unix-based tools, and command line interface syntax. The Unix OS supports tasks such as running hardware, device drivers, peripherals and third party applications. Share tips/comments. Read the comments. But most importantly: Read Disclaimer - Read Disclaimer.
Thursday, August 09, 2007
Capitalize Strings in UNIX
Subscribe to:
Post Comments (Atom)
3 comments:
funny...i was doing it with a loop
For those working on minimised systems where capitalize doesn't exist, a more portable solution is to use tr:
tr "[:lower:]" "[:upper:]"
and for those having a tr not knowing about classes : tr "[a-z]" "[A-Z]"
:)
Post a Comment