Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site rochester.UUCP Path: utzoo!watmath!clyde!bonnie!akgua!whuxlm!harpo!decvax!linus!philabs!cmcl2!seismo!rochester!henry From: henry@rochester.UUCP Newsgroups: net.jokes.d Subject: automatic joke reader Message-ID: <10361@rochester.UUCP> Date: Tue, 25-Jun-85 19:38:57 EDT Article-I.D.: rocheste.10361 Posted: Tue Jun 25 19:38:57 1985 Date-Received: Sat, 29-Jun-85 02:07:12 EDT Sender: henry@rochester.UUCP Organization: U. of Rochester, CS Dept. Lines: 64 From: Henry.Kautz Here is a shar file of a Unix program which automatically creates a file containing all the latest jokes, with the dirty ones rotated for you! To use it, type the command: newjokes After a few moments, it will create the file laughs.news . Note that it uses the uses the command "shift13". If this is not implemented on your system, replace this line with the appropriate "tr" command. The program uses awk to search the subject line of jokes to try it guess if it is rotated. It tends to error on the side of rotating (and thus zapping) unrotated jokes, but is suprisingly accurate most of the time. Note: be sure to put the files created (newjokes and screen) in you bin directory. #!/bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #!/bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # newjokes # screen # This archive created: Tue Jun 25 19:23:28 1985 export PATH; PATH=/bin:$PATH if test -f 'newjokes' then echo shar: over-writing existing file "'newjokes'" fi cat << \SHAR_EOF > 'newjokes' readnews -n net.jokes -p -h > JUNK awk -f /u/~/bin/screen JUNK shift13UNROT # more UNROT # more NOTROT /bin/rm laughs.news mv UNROT laughs.news cat NOTROT >>laughs.news /bin/rm JUNK ISROT NOTROT SHAR_EOF chmod +x 'newjokes' if test -f 'screen' then echo shar: over-writing existing file "'screen'" fi cat << \SHAR_EOF > 'screen' BEGIN {x=10} /^Subject:/{x=0;} /^Subject:.*13/||/^Subject:.*crypt/||/^Subject:.*rot/||/^Subject:.*ROT/{x=5} /^$/{ if ( (x==0) || (x==5) ) x +=1} /^Subject:/{if (x==0) {print "**************************" >"NOTROT"; print>"NOTROT";}else {print "**************************" >"ISROT"; print "Fhowrpg: Svygu" >"ISROT"; }} {if (x==6) print>"ISROT"} {if (x==1) print>"NOTROT"} SHAR_EOF # End of shell archive exit 0 ---- Henry Kautz :uucp: {seismo|allegra}!rochester!henry :arpa: henry@rochester :mail: Dept. of Comp. Sci., U. of Rochester, NY 14627 :phone: (716) 275-5766