Actually it is what I am doing. For each line in each file, I am comparing if they are equal or not. If yes they are stored in a temporary string, if no, they are pushed into two arrays. On the next line, if previous line was different and line is starting with a +, they are appended to the last elements in arrays. If the previous line wasn't different, if the line is still not different, it is joined to the previous temporary string, otherwise it is pushed into the arrays.
In the end, if the line and all following lines are equal, the temporary string content is discarded.
However, the more I think about it, the more it seems I could miss a line or mishandle it. Therefore I think I will move into dealing each file first then comparing them.
Thanks for the head up on this solution. It seems it is what you all are leaning towards to: reading first, comparing later. | [reply] [Watch: Dir/Any] |