Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting Lowercase to Initcap in Unix

Status
Not open for further replies.

skuthe

Programmer
Sep 10, 2002
33
0
0
US
Hi,
Can anyone help me to convert a parameter, supplied to a unix script, from lowercase to Initcap.
I tried using tr but could not get this done in a single command.

f.eg:
====
My shell script is test.com, I run this script with a parameter ...

$test.com diamond

The result I expect is Diamond

Pl. help.
Thanks.
 
Not really C++ but nevermind
Code:
echo diamond | awk '{print toupper(substr($1,1,1)) substr($1,2)}'
 
I'm sorry, I realised it after posting the message here.
Anyway thanks for the post. It worked for me !.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top