I need compare two text files. I should require ‘diff/lcs/Array’ when i
do this iam getting error. Should i install any additional gem(if yes
pls share the link). I am using Scite editor. As iam very new to ruby
kindly help me in this.
I need compare two text files. I should require ‘diff/lcs/Array’ �
when i
do this iam getting error.
I’ve tried using that library in the past, but its interface just �
makes it crazy hard to work with.
I came up with this for diff’ing 2 files and spitting the results to
stdout. It’s meant to simulate “diff -u” output, but it’s not quite
identical and is definitely not tested thoroughly:
diff_test.rb
require ‘diff/lcs’
The file ‘test1.txt’ contains the following 3 lines:
This is a house
Hello World
My favorite color is blue
The file ‘test2.txt’ contains the following 3 lines:
— test1.txt Wed Feb 25 12:18:42 -0700 2009
+++ test2.txt Wed Feb 25 12:18:53 -0700 2009
-This is a house
+This is a car
-My favorite color is blue
+My favorite color is green
I need compare two text files. I should require ‘diff/lcs/Array’
when i
do this iam getting error.
I’ve tried using that library in the past, but its interface just
makes it crazy hard to work with.
I came up with this for diff’ing 2 files and spitting the results to
stdout. It’s meant to simulate “diff -u” output, but it’s not quite
identical and is definitely not tested thoroughly:
diff_test.rb
require ‘diff/lcs’
The file ‘test1.txt’ contains the following 3 lines:
This is a house
Hello World
My favorite color is blue
The file ‘test2.txt’ contains the following 3 lines:
— test1.txt Wed Feb 25 12:18:42 -0700 2009
+++ test2.txt Wed Feb 25 12:18:53 -0700 2009
-This is a house
+This is a car
-My favorite color is blue
+My favorite color is green
Hope that was useful.
Regards,
Dan
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.