t*******y 发帖数: 81 | 1 awk 'BEGIN{findkey1=0;}
{if ($0 ~ /keyword1/){findkey1=1;}
if(findkey1=1){print;}
if($0 ~ /keyword2/){findkey1=0;}
}' input-file
it should all be on the same line.
not sure about the actual syntax since I don't have
a reference book at hand, but you get the idea. |
|