Shell compare multiple files against one base file (diff?)

Hi!

I'm trying to compare one base config file to 500 other config files and wanted some help.

Are there any command line tools that are built to solve this specific problem or perl/python?

I don't think diff was built for this. I'd appreciate any help!



Thanks!
 
Depends how big the differences are
If you expect big more or less big differences you could start by finding files, that actually differ from your main file.
In this little example I take file1 and compare it against file2 through file8:
Code:
#!/bin/sh
for a in $(ls | grep -E 'file[2-8]') ; do diff -q file1 $a | cut -d " " -f 4 >> differ ; done

% cat differ
file2
file3
file5
file8
Adapt it to your case, rename your main file to something unique and grep all other 499 files by a regular expression or put them all into one directory.
Then you got all filenames that differ from your main file in the file differ for further processing with a more precise approach.
 
gdiff --color=auto 500FilesDir/* --to-file=base_config_file
After reading k.jackers shell script more carefully I realised that I missunderstood the task in my previous posting. gdiff 500FilesDir/* --to-file=base_config_file -q will list only the files which differ.
 
Back
Top