Uppercasing and lowercasing is a common task when working with text. Below are examples of doing this with standard Linux/Unix utilities.

Lowercasing text with tr

tr 'A-Z' 'a-z'

Uppercasing text with tr

tr 'a-z' 'A-Z'

Lowercasing text with awk

awk '{print tolower($0)}'

Uppercasing text with awk

awk '{print toupper($0)}'

Lowercasing text with sed

sed 's/[A-Z]/\L&/g'

Uppercasing text with sed

sed 's/[a-z]/\U&/g'

Leave a Reply

How to Uppercase/Lowercase Text in Unix/Linux