I want to delete very other items leaving the selected ones from the list of files at a shot : I have a file with many other unwanted items in it i want to delete them all automatically leaving behind the data needed 

i have around 100 of cells i need only the cell name and all the pin and direction for those 100 cells and delete every other item 

grep -A 41435 'cell' lib | grep -iE '(cell|pin|direction)'(41437 no of lines in lib file) 
 
output

cell( FVOXY_O_W11X ) {                                                                                                                                   
        pa_p ( vcc ) {                                                                                                                                        
          direction : input;                                                                                                                                    
        pb_p ( vss ) {                                                                                                                                        
          direction : input;                                                                                                                                    
  is_macro_cell : true;                                                                                                                                         
pin(measure) {                                                                                                                                          
        related_p_pin : x ;                                                                                                                               
        related_g_pin : y ;                                                                                                                              
        direction : inout ;                                                                                                                                     
        original :measure;                                                                                                                         
} /* end of pin measure */                                                                                                                              
pin(pass) {                                                                                                                                                   
        related_p_pin : x ;                                                                                                                               
        related_g_pin :y ;                                                                                                                              
        direction : input ;                                                                                                                                     
        original : pass;                                                                                                                                  
} /* end of pin pass */

what i need
 
cell( FOVIO_NOM_D2DSYNC8X )

pin(measure)
 direction : inout 

pin(pass)
direction : input

Like such i have around 100 cell I want only the cell name and all the pin and direction of that cell can any one tell me how can 
 