using tr


 
Thread Tools Search this Thread
Special Forums UNIX Desktop Questions & Answers using tr
# 1  
Old 08-12-2008
using tr

Need to replace the first character in a string with the upper case equivalent. Not sure how to use "tr" in this case - all my attempts resulted in the whole word being converted to upper case. The first character is not fixed (will vary periodically).

Any suggestion?

Thanks
# 2  
Old 08-12-2008
Here are some examples, but does not include tr but might be helpful.

https://www.unix.com/shell-programmin...character.html
# 3  
Old 08-12-2008
Code:
# echo hello | nawk '{sub(".",toupper(substr($0,1,1)),$0)}{print}'
Hello

Login or Register to Ask a Question

Previous Thread | Next Thread
Login or Register to Ask a Question