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
> (yes, it breaks for perldoc style comments, comments on lines w/ code,
> # characters inside HERE docs, and probably other cases-- just an
> 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.
email@example.com mailing list
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"