I have 2 files that need to be compared. Email the differences if something is different and don't email if nothing is different. One or both of the files could be empty. One or both could have data in them.
example files
backup.doc.$(date +%y%m%d) file size is 0
backup.doc.$(TZ=CST+24 date +%y%m%d) file size is 412
or vice versa
Any help would be appreciated. I've tried the following but it seems to ignore if there is nothing in the file.
awk 'NR==FNR{a[$0]++;next} !($0 in a) {print $0}' backup.doc.$(date +%y%m%d) backup.doc.$(TZ=CST+24 date +%y%m%d) > /tmp/failed
[ -s /tmp/failed ] && cat /tmp/failed | mailx -s "Backup Failed" user@email.com