Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Difference in report files

Status
Not open for further replies.

columb

IS-IT--Management
Feb 5, 2004
1,231
EU
I have a daily report file which looks something like
Code:
Report for 25 June 2007
data
data
data
....
What I want to do is send an e-mail if the data in todays report is different from yesterdays. The problem, of course, is that, even when the data is the same the different date means I can't use a straight diff.

I could, of course, copy the two files, minus their first line, into temporary files and compare them but there must be a better way.

Ceci n'est pas une signature
Columb Healy
 
Thanks feherke. My RedHat boxes do, my AIX boxes don't and, of course, the reports are on the AIX system. I might copy down the source code and update the AIX diff!

Ceci n'est pas une signature
Columb Healy
 
What about this ?
diff file1 file2 | sed '/^1c1$/,/> Report for /d'

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Hmm...
What I was looking for was the equivalent of
Code:
diff file1 file2 >/dev/null && mail -s daily_report me@home < file2
but I could use your idea to do something like
Code:
[[ $(diff file1 file2 | sed '/^1c1$/,/> Report for /d' | wc -l) -gt 0 ]] && mail -s daily_report me@home < file2

Thanks PH

Ceci n'est pas une signature
Columb Healy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top