[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

which command I should use to extract the matching part out



Hi,

(sorry a bit off-list again, but I really found the list is an amazing place)

Well, for

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

I tried grep -A N "model 0"

but due to it's a very large file, the N really consume time to get.

I noticed the sed has the multiple line match function, but I tried
hard, still not able to get a working one,

looking for some powerful commands to do this,

Thanks ahead,

Best regards,


Reply to: