MYSYSAD.COM

Output Strings in Lowercase -- UNIX

· Shell & text

I should have done this post earlier when I was talking about capitalizing strings. I just forgot. Anyways, here's an easy way to output strings as lowercase.

# cat uppercasefile | tr "[:upper:]" "[:lower:]"
this file's contents are in uppercase
but its output should be
lowercased

# tr "[:upper:]" "[:lower:]" < uppercasefile
this file's contents are in uppercase
but its output should be
lowercased

# cat uppercase | tr '[A-Z]' '[a-z]'
this file's contents are in uppercase
but its output should be
lowercased

# tr '[A-Z]' '[a-z]' < uppercasefile
this file's contents are in uppercase
but its output should be
lowercased

Output lowercase strings to file
# tr '[A-Z]' '[a-z]' < uppercasefile > outputfile_lower

# date | tr "[:upper:]" "[:lower:]"
sat sep 8 23:24:20 kst 2007