Newsgroup: alt.folklore.computers


Path: icdoc!doc.ic.ac.uk!zmact61
From: zmact61@doc.ic.ac.uk (Diomidis Spinellis)
Newsgroups: alt.folklore.computers
Subject: Re: Cryptic comments (was re: non-volatile memory)
Message-ID: <1564@gould.doc.ic.ac.uk>
Date: 6 Feb 90 14:00:19 GMT
References: <1990Feb5.102014.13316@newcastle.ac.uk>
Sender: news@doc.ic.ac.uk
Reply-To: dds@cc.ic.ac.uk (Diomidis Spinellis)
Organization: Department of Computing, Imperial College, London, UK
Lines: 64
Content-Length: 2325
In article <1990Feb5.102014.13316@newcastle.ac.uk> Lindsay.Marshall@newcastle.ac.uk (Lindsay F. Marshall) writes:
>The program "cyntax" on 8th Edition UNIX had been run through a
>wonderful program (which was not distributed!!) that systematically
>renamed all the files in a directory as c1.c, c2.c etc. and also the
>variable names used in the program which were rewritten with long
>words which were, I suspect, chosen at random from /usr/dict/words.

The following shell script will substitute all the files 
in a directory given as its first argument with words from
the dictionary, starting with a, AAA, AAAS, AArhus, Aaron,
ABA, Ababa, aback etc.  It is supposed to create a script that 
will reverse this effect in /tmp/r.something.  Due to a bug in
tail -r this script will not be complete for big directories.
USE THIS AT YOUR OWN RISK.

#! /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:
#	trashdir
# This archive created: Mon Feb  5 20:51:08 1990
export PATH; PATH=/bin:$PATH
echo shar: extracting "'trashdir'" '(383 characters)'
if test -f 'trashdir'
then
	echo shar: will not over-write existing file "'trashdir'"
else
sed 's/^	X//' << \SHAR_EOF > 'trashdir'
	X#!/bin/sh
	XTMP=/tmp
	XDIR=$1
	XFILES=$TMP/f.$$
	XWORDS=$TMP/w.$$
	XCMD=$TMP/c.$$
	XREV=$TMP/r.$$
	Xtrap '' 0 1 2 3 15
	Xfind $DIR -depth -print >$FILES
	Xhead -`wc -l <$FILES|sed 's/[ 	]*//'` /usr/dict/words >$WORDS
	Xpaste $FILES $WORDS |
	Xsed -e '
	X/^\.	/d
	Xs/\(.*\)\/\(.*\)	\(.*\)/mv \1\/\2 \1\/\3/
	X' >$CMD
	Xrm $FILES $WORDS
	Xtail -r $CMD |
	Xsed -e '
	Xs/mv \(.*\) \(.*\)/mv \2 \1/
	X' >$REV
	Xsh <$CMD
	Xrm $CMD
SHAR_EOF
if test 383 -ne "`wc -c < 'trashdir'`"
then
	echo shar: error transmitting "'trashdir'" '(should have been 383 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0
--
Diomidis Spinellis                  Internet:                 dds@cc.ic.ac.uk
Department of Computing             BITNET:                   dds@cc.ic.ac.uk
Imperial College                    UUCP:   ...!cernvax!cc.imperial.ac.uk!dds
London SW7 2BZ                      JANET:                    dds@uk.ac.ic.cc



Newsgroup alt.folklore.computers contents
Newsgroup list
Diomidis Spinellis home page

Creative Commons License Unless otherwise expressly stated, all original material on this page created by Diomidis Spinellis is licensed under a Creative Commons Attribution-Share Alike 3.0 Greece License.