[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: strange output when using "tr" utility (?)
From: |
Eric Blake |
Subject: |
Re: strange output when using "tr" utility (?) |
Date: |
Wed, 23 Jan 2008 20:48:07 -0700 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
According to Nikos Alexandris on 1/23/2008 3:12 PM:
| Hi!
|
| I get following strange output when I try to... :
|
| $ tr "[a-z]" "A-Z"
| [After typing "hi i", I get:]
| IJ J
This is not a bug. Character ranges in tr do not need surrounding
brackets, so you've just done:
tr "[abcdefghi...yz]" \
~ "ABCDEFGHIJ...Z"
converting 'h' to 'I' (and deleting 'z').
However, since upper-casing and lower-casing can be locale-dependent, a-z
is not always adequate to specify lower-case characters, and it is safer
to do:
tr "[:lower:]" "[:upper:]"
- --
Don't work too hard, make some time for fun as well!
Eric Blake address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHmAp384KuGfSFAYARAqwQAKCXziwn5NWLL85Hwsz8DYquJqKf1ACgn2Q1
kX8tTSD9SSLYEDBJWQLSTs8=
=nRMl
-----END PGP SIGNATURE-----