one I find fun as you can do several versions for improved correctness,
robustness and efficiency  is find duplicate files in an input list
and useful every once in awhile to boot


version 01

for the input file list from $*  just crank md5sum,
sort and show list of matches
exclude empty files as all 0 byte files have the same content  :-)
tag your temp files with something like:  $(date +%Y%m%d-%H%M%S)-$$

version 02   more efficient:

add test to ensure file exists and is regular and readable
first sort by file size using wc -c
then only md5sum files of same size

this is a chance to use bash tables or more temp files as you please
consider sha1sum if md5sum matches

version 3  (annoying fussy more than  hard)

make it work where file names have embedded spaces and other evil chars
make it work to exclude duplicate file name entries as ./x.txt   and x.txt are 
same file
as are ~/mystuff.txt  and ~myacct/mystuff.txt

version 4 - full meal deal


consider more than 1 group of matching files eg  abcbbade
full deal requires diff to ensure not equal

ping me directly if you want to seminar some of these variants

Chris

I can write simple bash shell scripts.
For example recently I wrote the following:

       #/bin/bash

       if [ $# -eq 0 ]; then
             vi ~/Home/Personal/phone
       else
             grep $1 ~/Home/Personal/phone
       fi

I would like to be stronger though so I have dug up
some info from the Internet that I will now go through.

I figure it might be useful if anyone has some not too sys admin
deep shell scripts that need writing then I could write them for practice.
Proposals welcome remembering of course that you get what you pay for
and I will publish my results here (unless I get complaints).

Regards

Ralph (Rocky) Boland



--
God flunked Intelligent design

_______________________________________________
clug-talk mailing list
clug-talk@clug.ca
http://clug.ca/mailman/listinfo/clug-talk_clug.ca
Mailing List Guidelines (http://clug.ca/ml_guidelines.php)
**Please remove these lines when replying


<<attachment: caziz.vcf>>

_______________________________________________
clug-talk mailing list
clug-talk@clug.ca
http://clug.ca/mailman/listinfo/clug-talk_clug.ca
Mailing List Guidelines (http://clug.ca/ml_guidelines.php)
**Please remove these lines when replying

Reply via email to