Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

I want to compare all the content and report all differences.

If you feel better at home with external commands, diff is the one you should be looking at.

Also I am facing some challenge in comparing like when I have captured the content from Linux, it may not match against output from Windows (and vice-versa) since the line ending pattern of Windows would contain a \r\n (That’s a carriage return followed by linefeed) instead of a plain \n in the case of Linux. Please let me know how I can handle these

There are a few options for that. Again if you prefer external commands, look for dos2unix or unix2dos. In Perl, you can substitute with s/\015\012/\012/ - depending on your beforehand knowledge of the size of the files, if they are small, you can treat the whole file in one go or use a while loop to save memory and sacrifice time instead.

can you please let me know how to use Algorithm::Diff

Have you tried using some example from the Algorithm::Diff documentation? Did it produce an unforeseen result?

Again, the question of size may hit you here again. Just for the first go, I'll hope it doesn't ;-)

Cheers, Sören

Créateur des bugs mobiles - let loose once, run everywhere.
(hooked on the Perl Programming language)


In reply to Re^5: Getting error when trying to compare two files by Happy-the-monk
in thread Getting error when trying to compare two files by adalamre

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (6)
As of 2024-04-23 15:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found