unix

How can I convert all uppercase letters to lowercase in my file?

There are a few different ways to convert uppercase letters to lowercase.

One way is using the tr command. The example below demonstrates how you can use tr to convert to lowercase.

tr ‘[:upper:]’ ‘[:lower:]’ < myfile

This will convert this input file:

# cat myfile
ABCDEFGHIJKLMNOPQRSTUVWXYZ
abcdefghijklmnopqrstuvwxyz

to this:

abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz

An alternate way is using this syntax:

tr ‘[A-Z]’ ‘[a-z]’ < myfile

Click to comment

Leave a Reply

Your email address will not be published. Required fields are marked *

To Top