Last active
March 7, 2020 04:49
-
-
Save hoangdh/b70bb51e2d96e52d0a31af20e0f56c30 to your computer and use it in GitHub Desktop.
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 | |
compare(){ | |
file1="$1" | |
file2="$2" | |
count_m=0 | |
count_mn=0 | |
### So sanh phan zmlocalconfig | |
cat "$file1" "$file2" | grep -E "^zimbra.*"| awk {'print $1'} | sed 's/://' | sort -u | while read -r l; | |
do | |
f1=`cat "$file1" | grep -w "$l" | awk 'prev && id!=$1 {print prev} {prev=$0; id=$1} END {print prev}'` | |
f2=`cat "$file2" | grep -w "$l" | awk 'prev && id!=$1 {print prev} {prev=$0; id=$1} END {print prev}'` | |
if [ "$f1" != "$f2" ] | |
then | |
echo -e "===========\n$l" | |
echo -e "$file1: $f1" | |
echo -e "$file2: $f2" | |
echo -e "===Acount: ${f1}===\n${l}: NOT MATCH." >> logs.txt | |
count_n=`expr $count_nm + 1` | |
# else | |
# echo -e "===========\n$l\nMATCH!\nValue: $f1" | |
# echo -e "===Acount: ${f1}===\n${l}: MATCH." >> logs.txt | |
# count_nm=`expr $count_m + 1` | |
fi | |
done | |
} | |
mkdir -p result/ | |
folder1=$1 | |
folder2=$2 | |
ls $1 | sort -u | while read -r addr; do | |
if [ -e $folder1/$addr ] && [ -e $folder2/$addr ] | |
then | |
echo "Comparing: $addr" | |
compare $folder1/$addr $folder2/$addr > result/$addr | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment