On Fri, Dec 16, 2011 at 1:11 AM, Bob Proulx <bob@proulx.com> wrote: > lina wrote: >> aaa >> model 0 >> bbb >> ddd >> model 1 >> ccc >> >> I want to print out the parts which match the "model 0" and ends with >> match "model 1" >> >> for the final expected output is: >> >> model 0 >> bbb >> ddd > > Try this: > > sed -n '/^model 1/q;/^model 0/,$p' Cool !!! amazing !!! Thanks, > > Bob