2019-03-05 18:50:08 +00:00
|
|
|
#!/bin/bash
|
2019-09-13 10:31:57 +00:00
|
|
|
|
|
|
|
md5_source="2cp.md5"
|
|
|
|
md5_source_rm="2rm.md5"
|
|
|
|
|
|
|
|
md5_aim="aim.md5"
|
|
|
|
|
2019-03-19 16:21:53 +00:00
|
|
|
#wenn delete file exits -> handle deletons (importand for konflict handling
|
2019-09-13 10:31:57 +00:00
|
|
|
[ -f "${md5_source_rm}" ] && {
|
|
|
|
cat "${md5_source_rm}" | cut -c -32 | while read line; do
|
|
|
|
sed -i "/$line/d" "${md5_aim}"
|
2019-09-10 23:10:25 +00:00
|
|
|
done
|
2019-09-13 10:31:57 +00:00
|
|
|
cat "${md5_source_rm}" | cut -c 35- | while read line; do
|
|
|
|
l=$(grep " $line"$ "${md5_aim}")
|
2019-03-19 16:17:49 +00:00
|
|
|
[ -n "$l" ] && {
|
|
|
|
echo $l
|
|
|
|
md5=$(echo $l | cut -c -32)
|
2019-09-13 10:31:57 +00:00
|
|
|
sed -i "/$md5/d" "${md5_aim}"
|
2019-03-19 16:17:49 +00:00
|
|
|
}
|
|
|
|
done
|
2019-09-13 10:31:57 +00:00
|
|
|
rm ${md5_source_rm}
|
2019-03-19 16:17:49 +00:00
|
|
|
}
|
|
|
|
|
2019-03-05 20:28:17 +00:00
|
|
|
#gleiche dateien anhand md5 aussortieren
|
2019-09-13 10:31:57 +00:00
|
|
|
cat "${md5_aim}" | cut -c -32 | while read line; do sed -i "/$line/d" "${md5_source}" ; done
|
2019-03-05 20:28:17 +00:00
|
|
|
|
|
|
|
#dateien die verschiedenen md5 haben aber bei beiden existieren als konflikte behandeln
|
2019-03-05 20:32:31 +00:00
|
|
|
echo Konflicts:
|
|
|
|
echo
|
2019-09-13 10:31:57 +00:00
|
|
|
cat "${md5_aim}" | cut -c 35- | while read line; do
|
|
|
|
l=$(grep " $line"$ "${md5_source}" | tee -a konflicts)
|
2019-03-05 20:32:31 +00:00
|
|
|
[ -n "$l" ] && {
|
|
|
|
echo $l
|
|
|
|
md5=$(echo $l | cut -c -32)
|
2019-09-13 10:31:57 +00:00
|
|
|
sed -i "/$md5/d" "${md5_source}"
|
2019-03-05 20:32:31 +00:00
|
|
|
}
|
2019-03-05 20:28:17 +00:00
|
|
|
done
|