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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

difference between files (same file)

Status
Not open for further replies.
Oct 22, 2001
215
0
0
US
All,
I am trying to come up with a process of identifying the difference between two files that are extracted from ORACLE.

The issue is, there is no date when file A is extracted. After a week or so, this is file is extracted again. What I want to do , is to identify the deltas. What is being changed and what is new. Get this and discard the old file and use it for my case. The same is done every week.

Thanks in advance!!!
 
Some assumptions
1) the file is created in /home/workdir
2) the output file is called output

then
Code:
if [ -f /home/workdir/output ]
then
  diff /home/workdir/output* | mail -s "output differences" myuser@myhost
  rm /home/workdir/output.old
  mv /home/workdir/output /home/workdir/output.old
fi

run this from cron at a suitable time
 
Thanks.
Will the diff command identify all the changes in fields on the file? I think it will certainly get the new data.
Say, values in this file:

Key Name Address
1234 Some Name Address1

Changed to:
Key Name Address
1234 Some Name Address2

Again Changed to:
Key Name Address
1234 Name1 Address2

Again I get:
Key Name Address
1234 Name1 Address2


I should be able to get the record 3 times. First time, it is a new record. 2nd and third time , some thing changed. Fourth time it should not come since nothing changed for that record.
TIA
 
Are all these changes being reported in the same output file?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top