From: "William James" <> Date: 2009-12-19T03:40:07+09:00 Subject: Re: grep a block beny 18241 wrote: > > Hi, > > Please can anybody tell how to grep a block? > between 2 string i had few lines of code > > example: > > 1 > 2 > 3 > 4 > 5 > > > i've tried that way but its not working, see below my code: > > --- > #!/usr/bin/ruby > > filename = ARGV[0] > > > File.open(filename).each do |line| > if line =~ //../<\/mms:MmsCcppAccept>/ > puts line > end > end > ---- The tiny language Awk is good for things like this. awk "//,/<\/mms:MmsCcppAccept>/" file --