You can use the tr command in Linux to convert lowercase letters to uppercase letters by specifying the character sets for translation. Here’s the basic syntax:
tr 'a-z' 'A-Z' < input_file.txt > output_file.txt
Example
-
Create a sample text file:
echo 'hello world' > sample.txt -
Use the
trcommand to convert lowercase to uppercase:tr 'a-z' 'A-Z' < sample.txt > uppercase_sample.txt -
To verify the content of the new file:
cat uppercase_sample.txt
You should see:
HELLO WORLD
This command reads from sample.txt, converts all lowercase letters to uppercase, and saves the result in uppercase_sample.txt.
