Created
January 27, 2015 15:36
-
-
Save barryrowlingson/4ec82ea4ad26dcb48b06 to your computer and use it in GitHub Desktop.
sequential file diff
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$#" == "0" ]; then | |
echo "diff [file1] [file2] ..." | |
echo " Does diff file1 file2 ; diff file2 file3 ; diff file3 file4 ; etc" | |
exit 1 | |
fi | |
first="$1" | |
shift | |
while (( "$#" )); do | |
diff "$first" "$1" | |
first="$1" | |
shift | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Needed for comparing monthly update files. Quickly see what changed each month. Use case was some huge NHS prescription chemical CSV files which get published every month, and only one or two lines change most months. Each pair of diff outputs shows the monthly changes.
For my data the first line in each file had the month, so it was obvious which files were being compared, stick an echo in the loop if you need to see explicitly.
I'd like to tweak this so you can pass args through to diff but some other time.