Diff for 2 Text Files


#1

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

thanks

jack


#2

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


#3

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”


#4

Ryan D. wrote:

he said “easy”

DOAH! :slight_smile:


#5

Josef ‘Jupp’ Schugt wrote:

On Thu, 16 Oct 2008 01:04:31 +0200, jackster the jackle
removed_email_address@domain.invalid 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:


#6

On Thu, 16 Oct 2008 01:04:31 +0200, jackster the jackle
removed_email_address@domain.invalid 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


#7

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/


#8

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


#9

On 2008-11-05 01:16:43 -0500, Mark M. removed_email_address@domain.invalid 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/