[plug] comparing files

Rob Dunne robd at anville.wa.cmis.csiro.au
Sat Jun 16 21:33:34 WST 2001


Jon  Miller writes:
 > I would like to know how to compare 2 files of the same name 
>  and take the difference and merge it into the newer file.
 > I'm seen somewhere where it had to do with the diff command, 
> but I'm not too sure about the merging of the differences.

Hi Jon,
      use "grep --ed" to create a ed script. You will
need to add some commands at the end to get ed to save the file.
here is an example
                    bye

lycra >cat > t1
1 
2
3
4
5
6
7
8
9
10
lycra >cat > t1
1
2
4
5
6
7
9
10
lycra >diff --ed t1  t2 > ed.script
lycra >cat > end
w t3                      #write the changes out to t3
q                         # quit 
lycra >cat ed.script end > ed.script2
lycra >ed -s t2 < ed.script2
17
22
lycra >diff t1 t3
lycra >

-- 
 Rob Dunne         Fax: +61 8 9333 6121     Tel: +61 8 9333 6178
 CSIRO Mathematical and Information Sciences
 Leeuwin Centre for Earth Sensing Technologies 
 Private Bag 5, P.O., Wembley, Western Australia, 6013         
 http://matilda.vu.edu.au/~dunne  Email: Robert.Dunne at cmis.csiro.au

        Java has certainly revolutionized marketing and litigation.




More information about the plug mailing list