How do you replace the first letter of a word into Capital letter, e.g.
Trouble me Gold rush brides
into
Trouble Me Gold Rush Brides
Use ^ to convert the first letter to uppercase and ^^ to convert all characters to uppercase. Use , to convert the first letter to lowercase and ,, to convert all characters to lowercase. Use ~ to toggles the case for the first character and ~~ to toggle cases for all characters.
@CMCDragonkai: To lowercase the first letter, use "${foo,}" . To lowercase all the letters, use "${foo,,}" . To uppercase all the letters, use "${foo^^}" .
To define uppercase, you can use [:upper:] or [A-Z] and to define lowercase you can define [:lower:] or [a-z]. The `tr` command can be used in the following way to convert any string from uppercase to lowercase. You can use `tr` command in the following way also to convert any string from lowercase to uppercase.
This line should do it:
sed -e "s/\b\(.\)/\u\1/g"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With