Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: How best to strip text from a file?

by sundialsvc4 (Abbot)
on Nov 02, 2012 at 13:58 UTC ( #1001975=note: print w/replies, xml ) Need Help??

in reply to How best to strip text from a file?

The tool that was the original inspiration for Perl, awk, points to what might be a good, generalized way to approach this problem.

Consider the inputs that you have, one line at a time.   Each line of data is recognizable as being of a particular type, by conforming to some pattern.   For each line-type, the “interesting bits” can also readily be found by a line-type specific regular expression.   You can see that this sort of problem could be described in terms of a list of regular-expressions which are to be tested one-by-one (thus identifying the line type), with a short block of code to describe what to do with each one.   Which is exactly the approach that awk does take, and which a Perl program also can take.

  • Comment on Re: How best to strip text from a file?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1001975]
[Corion]: Meh. SQL window functions would even make pagination easy/trivial (but not performant), as rank() over (partition by user order by timestamp) / 10 as page would give me a page number for each item, with 10 items per page.

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (9)
As of 2018-03-22 12:13 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (274 votes). Check out past polls.