From: Ron Hopper Date: 2007-03-23T01:28:36+09:00 Subject: Re: Help processing a file or array ------=_Part_222872_2207107.1174580912532 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 3/22/07, Eduardo Y=E1=F1ez Parareda wrote: > > > lines =3D File.new("file1").readlines > tags =3D File.new("file2).readlines > > Is there a Ruby way to remove lines from 'lines' variable which contain > tags from 'tags' variable? > The most straightforward way seems to be: lines.reject do |line| tags.any? do |tag| line.include? tag.chomp end end ...or the same thing a bit more succinctly: lines.reject {|line| tags.any? {|tag| line.include?(tag.chomp) }} - chopper ------=_Part_222872_2207107.1174580912532--