34.12 Transformations on TextThe transform command ( y ) is useful for exchanging lowercase letters for uppercase letters on a line. Effectively, it performs a similar function to tr ( 35.11 ) . It replaces any character found in the first string with the equivalent character in the second string. The command:
y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/ will convert any lowercase letter into the corresponding uppercase letter. The following:
y/abcdefghijklmnopqrstuvwxyz/nopqrstuvwxyzabcdefghijklm/ would perform a rot13 transformation - a simple form of encryption in which each alphabetic character is replaced by the character halfway through the alphabet. ( rot13 encryption is sometimes used to keep offensive news postings ( 1.33 ) from being read except by someone who really means to. Encryption and decryption are automatically supported by most news readers, but it's fun to see how simple the encryption is. By the way, the command above handles only lowercase letters; if we'd shown uppercase as well, the command would have run past the margins!) - |
|