In the last episode (May 17), Kelly Jones said: > 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
Take a look at the -I option to diff. It lets you ignore lines matching a specified regex. > (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 No suggestions here. Sorting a file is not something diff should do imho. -- Dan Nelson dnel...@allantgroup.com _______________________________________________ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"