#!/bin/bash

# IMPORTANT : In the FILEPATH $1, $2 there can't be any spaces

FILE1=$1
FILE2=$2

RESULTS1=$(grep -r "% SZS status" "$FILE1" | cut -d " " -f 1,4,8 | rev | cut -d "/" -f 1,3 --output-delimiter "%" | rev | cut -d "%" -f 1,3 --output-delimiter " " | cut -d " " -f 1,3 | sort -k6)
RESULTS2=$(grep -r "% SZS status" "$FILE2" | cut -d " " -f 1,4,8 | rev | cut -d "/" -f 1,3 --output-delimiter "%" | rev | cut -d "%" -f 1,3 --output-delimiter " " | cut -d " " -f 1,3 | sort -k6)

THM1=$(echo "$RESULTS1" | grep "Theorem" | wc -l)
THM2=$(echo "$RESULTS2" | grep "Theorem" | wc -l)


diff --speed-large-files -d  --suppress-common-lines -y <(echo "$RESULTS1") <(echo "$RESULTS2")
echo "Theorem left: $THM1"
echo "Theorem right: $THM2"
