Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 (Tek) 9/26/83; site tekred.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!bellcore!decvax!tektronix!tekred!ronbe From: ronbe@tekred.UUCP (Ron Bemis ) Newsgroups: net.jokes.d Subject: Re: Rotating jokes (comments) Message-ID: <255@tekred.UUCP> Date: Tue, 26-Feb-85 15:29:48 EST Article-I.D.: tekred.255 Posted: Tue Feb 26 15:29:48 1985 Date-Received: Sun, 3-Mar-85 04:45:39 EST References: <248@tekred.UUCP>, <1367@ut-ngp.UUCP> Organization: Tektronix, Redmond OR Lines: 39 > ...However, it is possible to > improve on Ron's script by replacing the sed command: > sed\ > -e '/^$/,$y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/NOPQRSTUVWXYZABCDEFGHIJKLM/'\ > -e '/^$/,$y/abcdefghijklmnopqrstuvwxyz/nopqrstuvwxyzabcdefghijklm/'\ > with a tr command: > tr 'A-Za-z' 'N-ZA-Mn-za-m' > If you use csh, then you can even put the line: > alias rot tr 'A-Za-z' 'N-ZA-Mn-za-m' > in your .cshrc file. That way you can use the ! command from vi or ex > to rotate text in articles you post. Well, I thought it would be obvious what I was doing differently, but I guess not. My little program does a translation on ALL BUT THE HEADER. If I save something, it's usually so I can come back later and look at it. Thus, I like to be able to read the unrotated header. It's all in the '/^$/,$' part (rotate from the first blank line to the end). I do have an alias for rot, but it's part of a file called .aliases that gets sourced (source .aliases) at login. The quotes are placed a little differently, too: alias rot 'tr n-za-mN-ZA-M a-zA-Z' It would be nice to use tr instead of sed, because I think it would be faster, but tr can't rotate just a part of standard input. I've gotten mail telling me that a Bourne shell script would be faster, but when the program was shown, it looked a little more cumbersome than the original, so I'm happy with what I've got. I was just trying to imitate the normal 's' command, with rotation added, and I've done that. Cheers, -- tektronix!tekred!ronbe _____ Support Bacteria - Ron Bemis / o o \ It's the only Tektronix | \___/ | culture some Redmond, OR \_____/ people have!