Make the assumption that the string won't wrap 3 or more lines (though unlikely)
I am a bit confused by this. It looked as though "filename" contained a list of string or re's to match. It seems as though the remaining files contain lines of data. I guess what this means is that the string to match could be very long: possibly 3+ lines. Is that correct?
Some ideas that might get you going:
- Could you modify tcgrep to do what you want? It seems to be pretty close.
- Using the "finger scan" is really ineffecient. This is one reason the re engine is nice. Lots of credit goes to Aho. Here is an article
describing the math. It gets complex, but that is why we have the perl re engine and why we have study.
- It seems as though what you need is a special kind of string that looks to the re engine like a string, but reads from STDIN when it needs to and throws out data in the process: a circular buffer. I searched CPAN and could not find such a beast. Maybe this is a good project?
HTH, --traveler
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|