How to capitalize first letter of each line in bash?

bash, capitalization, linux, sed, uppercase

Solution

Why do you need to use something else than `\U`?

You can use `\u` which only capitalizes one letter:

sed 's/./\u&/'

Or, use parameter expansion:

while read line ; do echo "${line^}" ; done

Problem

I'm looking for a command that capitalizes the first letter of each line in bash. Actually I used this command: ``` sed 's/^\(.\)/\U\1/' ``` But I need to use another command instead of "\U". .

Original source

Related problems