Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: File handles in regular expressions

by sundialsvc4 (Abbot)
on Oct 22, 2012 at 13:36 UTC ( #1000342=note: print w/ replies, xml ) Need Help??


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.


Comment on Re: File handles in regular expressions
Re^2: File handles in regular expressions
by Laurent_R (Parson) 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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1000342]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (10)
As of 2014-10-20 11:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (75 votes), past polls