From: Robert Klemme Date: 2008-03-26T21:15:06+09:00 Subject: Re: remove regex matched line question 2008/3/25, Ryan Davis : > You're not rejecting anything complicated, so it is just as easy to > select what you want instead of rejecting what you don't want: > > puts File.read("./src.txt").grep(/^[^#]/).join("\n") You can as well do this which is a tad shorter and probably also more efficient than reading into a single String: puts File.readlines("./src.txt").grep(/^[^#]/) Kind regards robert -- use.inject do |as, often| as.you_can - without end