http://www.perlmonks.org?node_id=1000342


in reply to File handles in regular expressions

Of course, on a Unix/Linux system you can do this with the diff command, with appropriate options (that might be system specific).

I say this because this is an extremely common requirement and yet it is also very common to build one-off custom programs to satisfy such requirements.   I say that without specific reference to this particular case or person.   “I need to write a program to do this” is a conclusion that is quickly and easily jumped-to, especially when the prospect of doing so seems daunting.   TMTOWTDI™, and sometimes TOWTDI isn’t Perl or a custom program at all.

Replies are listed 'Best First'.
Re^2: File handles in regular expressions
by Laurent_R (Canon) on Oct 24, 2012 at 14:02 UTC

    Yes, diff can be useful, and on Windows, you can use Winmerge, a public domain utility to compare files (there are most probably others). But these utilities require the files to be sorted in the same order, which might not be the case. And if you have to start sorting each file before comparing them, then a simple Perl one-liner might do the job faster.

    At my work, we are using daily all kinds of combinations of Unix "power tools", including pipes and redirections to connect diff, sort, wc, cat, grep, find, cut, sed, awk, etc. commands, but Perl offers very often a better, simpler and faster way to do things.

    And when I have to work on VMS or on Windows, where you don't have sed, cut or awk, Perl shows its superiority even more blatantly.