[svlug] $GREP question

Eric De Mund ead-svlug at ixian.com
Sun Feb 13 16:44:53 PST 2011


All,

[$GREP question]
Hello. How can I $GREP (generically search) a document for a pattern
and return the records in which it appears, where "record" means either:

1.  content delimited by blank lines (perlpod's "paragraph" definition)

    or:

2.  content within some specified "begin" and "end" lines, e.g.
    =begin record
    "The trouble ain't that there is too many fools, but that the
    lightning ain't distributed right."

    --Mark Twain
    =end record

My problem is that I have (and want to have) text files that contain
both kinds of "records", and I want to be able to search them. Outside
of begin-end pairs, I want the blank-line definition to hold, and inside
the begin-end pairs, well, I want the begin-end definition to hold.

Is this a solved problem? Manber and Wu's agrep(1) comes close, but an
agrep(1) delimiter must be a fixed string and not a regular expression.

[meta-question]
What other forums are good ones for this kind of question?

Thank you!

Eric
--
Eric De Mund   |  Y!: ead0002
ead at ixian.com  |  ICQ: 811788




More information about the svlug mailing list