E
Eduardo Yáñez Parareda
Hello, I'm a newbie, and need some help to process a file.
The file has lines with something like this:
rewrewrwer rrrrrrrrrrrrr aa1 rrrrrrrrrr
rewrwerwer rrrrrrrrrrrrr bb1 rrrrrrrrrr
rwerfwdffsd rrrrrrrrrrrrr cc1 rrrrrrrrrr
ewrwerwerwer rrrrrrrrrrrrr dd1 rrrrrrrrrr
trtretertert rrrrrrrrrrrrr ee1 rrrrrrrrrr
and another file with
aa1
cc1
I'd like to create a new file without lines containing aa1 and cc1
Reading the files and get arrays with the content is easy:
lines = File.new("file1").readlines
tags = File.new("file2).readlines
Is there a Ruby way to remove lines from 'lines' variable which contain tags from 'tags' variable?
The file has lines with something like this:
rewrewrwer rrrrrrrrrrrrr aa1 rrrrrrrrrr
rewrwerwer rrrrrrrrrrrrr bb1 rrrrrrrrrr
rwerfwdffsd rrrrrrrrrrrrr cc1 rrrrrrrrrr
ewrwerwerwer rrrrrrrrrrrrr dd1 rrrrrrrrrr
trtretertert rrrrrrrrrrrrr ee1 rrrrrrrrrr
and another file with
aa1
cc1
I'd like to create a new file without lines containing aa1 and cc1
Reading the files and get arrays with the content is easy:
lines = File.new("file1").readlines
tags = File.new("file2).readlines
Is there a Ruby way to remove lines from 'lines' variable which contain tags from 'tags' variable?