From: Nico Hoogervorst Date: 2003-02-14T20:04:33+09:00 Subject: Re: How to write filesearch with begin-pattern till end-pattern > At Fri, 14 Feb 2003 19:15:05 +0900, > Nico Hoogervorst wrote: > > In perl I can search through files, > > matching every line between two patterns. > > Example: > > > > perl -ne 'print "$ARGV:$_" if /black/ .. /cat/' *.txt > > ruby -ne 'print "#{ARGV}:#{$_}" if /black/ .. /cat/' *.txt > > -- > Nobu Nakada > Thanks, However, the filename wasn't printed (ARGV.length = 0), so I changed it into: ruby -ne 'print "#{$FILENAME}:#{$_}" if /black/ .. /cat/' *.txt I am using ruby 1.6.7 -- Nico --