I want to compare two text(html) files. “diff” command in Linux compares
only by line.
In Ruby, I can use “File.readlines” and “split” later. Is there a single
function(method) to go from a file to an array of words.
Thanks

I want to compare two text(html) files. “diff” command in Linux
compares only by line.
In Ruby, I can use “File.readlines” and “split” later. Is there a
single function(method) to go from a file to an array of words.

What is a word in your context? If you want an array of tokens
consisting
only of word characters you can do

words = File.read(file_name).scan(/\w+/)

Note though that this is memory intensive for large files. This is a
bit
more efficient: