Smart multiline grep?
    David Nicol 
    davidnicol at gmail.com
       
    Tue Jun 21 11:54:35 CDT 2005
    
    
  
> if I search for
> "proto_tree_add_text" I want back
> 
>     proto_tree_add_text(subtree, tvb,
>         curr_offset, 1,
>         "%s :  Reserved",
>         bigbuf);
> 
> and
> 
>     proto_tree_add_text(tree, tvb, offset, payload_len, "Payload");
> 
> equally.  I _don't_ want the extra one-size-fits-all fluff returned by
> GNU grep's "-A" flag.
how about this untested one-liner:
perl -ne 'BEGIN{undef $/};print /(proto_tree_add_text\s*\(.+?;\s+\n)/gs'
i think the semicolon will work as a search terminator, ymmv of course
-- 
David L Nicol
free as in unenforceable
    
    
More information about the Kclug
mailing list