Last active
November 9, 2022 02:23
-
-
Save irisdyoung/68bb60fe3109105959d87d32fbc77e1a to your computer and use it in GitHub Desktop.
Recursively diff a pair of files, to allow for the same lines to be in different orders without being marked as different
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 | |
recursive_diff() { | |
diff $1 $2 > tmptmptmp.diff | |
export diffsize=`ls -l tmptmptmp.diff | awk '{ print $5 }'` | |
while [ ! "$diffsize" == "$newdiffsize" ]; do | |
export diffsize=`ls -l tmptmptmp.diff | awk '{ print $5 }'` | |
cat tmptmptmp.diff | grep "^<" | cut -c 3- > tmptmptmp1.phil | |
cat tmptmptmp.diff | grep "^>" | cut -c 3- > tmptmptmp2.phil | |
diff tmptmptmp1.phil tmptmptmp2.phil > tmptmptmp.diff | |
export newdiffsize=`ls -l tmptmptmp.diff | awk '{ print $5 }'` | |
done | |
cat tmptmptmp.diff | |
rm tmptmptmp1.phil tmptmptmp2.phil tmptmptmp.diff | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment