Diff for 2 Text Files

Is there an easy way available in Ruby to compare two text files and
report the differences?

thanks

jack

jackster the jackle wrote:

Is there an easy way available in Ruby to compare two text files and
report the differences?

http://raa.ruby-lang.org/project/diff-lcs/

a

On Oct 15, 2008, at 16:44 , Alex F. wrote:

jackster the jackle wrote:

Is there an easy way available in Ruby to compare two text files and
report the differences?

http://raa.ruby-lang.org/project/diff-lcs/

he said “easy”

Ryan D. wrote:

he said “easy”

DOAH! :slight_smile:

Josef ‘Jupp’ Schugt wrote:

On Thu, 16 Oct 2008 01:04:31 +0200, jackster the jackle
[email protected] wrote:

Is there an easy way available in Ruby to compare two text files and
report the differences?

%x(diff file1 file2) # Unix/Linux

Josef ‘Jupp’ Schugt

now that’s what I call “easy” :slight_smile:

On Thu, 16 Oct 2008 01:04:31 +0200, jackster the jackle
[email protected] wrote:

Is there an easy way available in Ruby to compare two text files and
report the differences?

%x(diff file1 file2) # Unix/Linux

Josef ‘Jupp’ Schugt

You can expand on this approach if you’re outputting to an html view
too:
http://markmcb.com/2008/11/04/ruby-on-rails-diff-text-to-html-ins-and-del/

how about visual diff like the image
http://tiny.cc/fnbiz

On 2008-11-05 01:16:43 -0500, Mark M. [email protected] said:

You can expand on this approach if you’re outputting to an html view
too:
http://markmcb.com/2008/11/04/ruby-on-rails-diff-text-to-html-ins-and-del/

I found a good module for this a long time ago. I keep it on my github,
hoping some day to discover where it actually came from.

http://github.com/myobie/htmldiff/

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs