title: how to grep a particular pattern and particular content under that pattern in bash excluding all the other content in that file
body: <p>I have a lib file,i want to grep a particular cell, pin and direction of that cell leaving out the other unwanted data of the other cell and there respective pin and direction. i have around 10 cells </p>
  
  <p><strong>lib file</strong></p>
  
  <pre><code>macro cell A
  class
  origin
  size
  pin:sdf
  direction:input
  layer
  port
  end
  
  macro cell B
  class
  origin
  size
  pin:vcc
  direction:output
  layer
  port
  end
  
  macro cell C
  class
  origin
  size
  pin:vee
  direction:inout
  layer
  port
  end
  </code></pre>
  
  <p>output what i want </p>
  
  <pre><code>macro cell A
  pin:sdf
  direction:input
  </code></pre>
  
  <p>how can i do this </p>