Please see this


Contents

- INDEX
- HP-UX Index
- Solaris
- Linux Index
- Other Unix types
- General Unix
- Unix Networking
- Unix Scripts
- Unix databases

Associated Information

- Unix Scripts Tips

Useful Links

- Bash shell HOWTO
- Bourne Shell Man Page
- C Shell Guide
- Korn Shell Resources

Diff.sh

#!/usr/bin/ksh # Work out the difference in files FILE1=$1 FILE2=$2 TEMP=/tmp # Ensure input files are sorted sort -o $TEMP/$FILE1.sorted $FILE1 sort -o $TEMP/$FILE2.sorted $FILE2 # Merge two files together sort -o $TEMP/outfile.$$ $FILE1 $FILE2 # Get a list of uniqe entries, i.e. either in file1 or file2 only uniq -u $TEMP/outfile.$$ $TEMP/outfile2.$$ # Compare unique entries against file1, if they appear in unique file only # must have been in file2 only..... echo "The following files were in $FILE2 only ...." comm -13 $TEMP/$FILE1.sorted $TEMP/outfile2.$$ # Compare unique entries against file2, if they appear in unique file only # must have been in file1 only..... echo "The following files were in $FILE1 only ...." comm -13 $TEMP/$FILE2.sorted $TEMP/outfile2.$$ # Tidy Up rm $TEMP/$FILE1.sorted rm $TEMP/$FILE2.sorted rm $TEMP/outfile.$$ rm $TEMP/outfile2.$$ #### END OF SCRIPT

Copyright 2000 Intronet Computers Ltd
Email: Intronet Computers for enquiries