dblack / wobblini.net wrote: > Hi -- > > On Sat, 26 Aug 2006, William James wrote: > >> Oliver Bandel wrote: >> >>> Hello, >>> >>> >>> The Code: >>> >>> ==================================== >>> def look_for_begin >>> while line = gets >>> if line =~ /^begin/ >>> puts line >>> # return >>> end >>> end >>> end >>> >>> ARGF.each { look_for_begin } >>> ==================================== >> >> >> puts ARGV.map{|f|IO.readlines(f).find{|s|s=~/^begin/}} > > > Or maybe: > > puts ARGF.find {|s| /^begin/.match(s) } [...] Theese both things looks like if they would look for *all* occurrnces of "begin", not the first one. I also think to look only in the first 1000 lines or so... Ciao, Oliver P.S.: But I now also found files, where more than one uuencoded section was inside... ... so, maybe reading the files complete also could make sense... (I didn't found such files before, so I thought it would make sense to read only until the first occurence of /^begin/)