in reply to Re^2: Tagging the differencies in both files
in thread Tagging the differencies in both files

Thats why I left it to the OP, :-) , and remarked you would need to expand the hashes to contain all the line data per file. Just as an initial brainstorm, in addition to the hash where you count duplicates, you would have 2 other hashes with each line as key and $filename:linenumber as value. Then in a relatively complex logic loop, you would first find duplicates, then reloop thru each file, testing each line for duplicates, and comparing $filename:linenumbers thru the hash key searches. I'm sure with enough diligence it can be done, because all the information is available in the 3 hashes. Of course, that's just my first thoughts, someone else may know a sweeter way involving less logic. You could also look at tkdiff, it isn't perl tk, but it does color highlighting the way you desire.

I'm not really a human, but I play one on earth.
Old Perl Programmer Haiku ................... flash japh
  • Comment on Re^3: Tagging the differencies in both files

Replies are listed 'Best First'.
Re^4: Tagging the differencies in both files
by h@kim (Initiate) on Jun 18, 2012 at 05:54 UTC
    Thank you for your responses. But the question was answered in another forum. I also asked this question here: http://stackoverflow.com/questions/11070174/tagging-the-differencies-in-both-files and I got a good answer. the code below does the task that I want:
    diff --old-line-format "<Diff></Diff>%c'\012'" \ --new-line-format "<Diff>%l</Diff>%c'\012'" \ File1.txt File2.txt > NewFile1.txt diff --old-line-format "<Diff>%l</Diff>%c'\012'" \ --new-line-format "<Diff></Diff>%c'\012'" \ File1.txt File2.txt > NewFile2.txt