convert string from uppercase to lowercase in shell script code example
Example 1: bash transform uppercase to lowercase
Just use tr command to transform lowercase letters into uppercase as:
tr a-z A-Z < file.txt #transforms letters into uppercase in a file
echo 'HELLO' | tr A-Z a-z #Outputs: 'hello'
Example 2: bash how to convert text to lowercase or uppercase
# Basic syntax:
tolower(string)
toupper(string)
# Example usage:
awk '{print tolower($0)}' input_file
# This prints every row ($0) converted to lowercase
awk '{print toupper($3)}' input_file
# This would print the third field ($3) converted to uppercase