Howto: convert string to all lowercase

From Linux Bash Shell Scripting Tutorial Wiki
Jump to navigation Jump to search

To easily convert a text string to LOWERCASE we use the built-in bash commands:

  • echo
  • tr
$ echo CONVERT THIS TO LOWERCASE | tr [A-Z] [a-z]
convert this to lowercase
$

To convert a complete file we use the '<' redirect:

$ tr [A-Z] [a-z] < CONVERT_TO_LOWERCASE.txt
convert this to lowercase
$