From: Brian Candler Date: 2008-12-11T00:20:39+09:00 Subject: Re: compare 2 text files - check for difference - Please help Mmcolli00 Mom wrote: > I just used this on my txt files however, I can't get the script to > output only when a line was disimillar. Right now it shows everything. > > p sdiff = lines1.sdiff(lines2) > > I want to output the following if sdiff returns the @action=! > [# elements="1,2\n","1,2,3\n"> I don't understand. If the two files are identical, you should get an empty array. Is that not the case? You can test for an empty array using sdiff.empty? If the two files are not identical, you will get a series of elements telling you chunks which are different, and for each chunk what is different. This is similar to the "diff" command at the shell. -- Posted via http://www.ruby-forum.com/.