Created
March 12, 2015 23:22
-
-
Save mca-gif/10c55eab8a9a15217c9f to your computer and use it in GitHub Desktop.
Run diff on set of files which possibly changed over time
This file contains 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 [[ $# -lt 2 ]]; then | |
echo "$0 <file1> <file2> <file3> [file4]" | |
echo "This script is meant to run on 3 or more files, to see the changes over time." | |
exit 1 | |
fi | |
while [[ $# -ge 2 ]]; do | |
TEST=$(diff -q $1 $2) | |
if [ -n "$TEST" ]; then | |
echo "" | |
echo "$2" | |
diff $1 $2 | |
fi | |
shift | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
My use case was a set of XML files which were uploaded by a 3rd party service multiple times a day, regardless of whether the data changed. Using this, I was able to figure out which files had changes, and what those specific changes were.