Sunday, November 20, 2005

Upper Case to Lower Case

Unix way' of doing things.

Let's take a small sample file, `dat' containing the words:

top
Eat
opt
tea
Pot
ate

Some words begin with an uppercase character, the step to convert everything to lowercase:

cat dat | tr 'A-Z' 'a-z'

Now, do a dictionary sort based on the first word:
cat dat | tr 'A-Z' 'a-z' | sort

Isn't it interesting?

No comments: