Output Strings in Lowercase -- UNIX

This is something I found on someone else’s blog which i find useful, its always the simple things you forget.

# 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]'  outputfile_lower
# date | tr "[:upper:]" "[:lower:]"

sat sep  8 23:24:20 kst 2007

From: http://www.mysysad.com/2007/09/output-strings-in-lowercase-unix.html

Share