Better version of diff?
Kelly Jones
kelly.terry.jones at gmail.com
Sun May 17 21:29:20 UTC 2009
I often need to compare two Perl files sans comments. This mostly works:
egrep -v '^#' file1.pl > file1.tmp
egrep -v '^#' file2.pl > file2.tmp
diff -B file1.tmp file2.tmp
(yes, it breaks for perldoc style comments, comments on lines w/ code,
# characters inside HERE docs, and probably other cases-- just an
approximation)
I also often need to see if two files contain the same lines, minus
comments and allow duplicates. This mostly works:
egrep -v '^#' file1.txt | sort | uniq > file1.tmp
egrep -v '^#' file2.txt | sort | uniq > file2.tmp
diff -B file1.tmp file2.tmp;: comm would also work here
I could easily Perl script these two tasks, but my question is: has
anyone created a "super diff" that does this sort of thing and more?
--
We're just a Bunch Of Regular Guys, a collective group that's trying
to understand and assimilate technology. We feel that resistance to
new ideas and technology is unwise and ultimately futile.
More information about the freebsd-questions
mailing list