Smart multiline grep?

Gerald Combs gerald at ethereal.com
Tue Jun 21 09:49:17 CDT 2005


Is there a grep-like utility that will return a variable number of
context lines?  I need to search through source code for occurrences of
a particular function and get back the function plus its arguments, even
if they're split across multiple lines.  E.g. 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.



More information about the Kclug mailing list