Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re^2: Parsing a data field that is seperated by data/time entries

by TASdvlper (Monk)
on Apr 14, 2005 at 18:32 UTC ( [id://447900]=note: print w/replies, xml ) Need Help??


in reply to Re: Parsing a data field that is seperated by data/time entries
in thread Parsing a data field that is seperated by data/time entries

Actually, I can't assume double lines. i just did it that way to make it easier to read. And sometimes, there are double lines within the description (e.g. if people are writing a couple of paragraphs per update). I'm guessing, I'm gonna have to something like finding the very last time stamp and capturing all the following text.
  • Comment on Re^2: Parsing a data field that is seperated by data/time entries

Replies are listed 'Best First'.
Re^3: Parsing a data field that is seperated by data/time entries
by Roy Johnson (Monsignor) on Apr 14, 2005 at 18:41 UTC
    You can vary what you look for, based on what you know about the data. If newline followed by an open-square-bracket is reliable enough, you can do
    my $whatIwant = substr($wholefield, rindex($wholefield, "\n[")+1);
    If you need to match the timestamp format to reliably know that you've found a comment boundary, you'll need to use a regex, as frodo72 illustrated in his example 3. Spell out as much as you need to to get a reliable boundary.

    No matter what you choose, it will be possible that one of the comments includes the pattern you look for. That's only a problem if it happens to be the last comment, in which case you'll end up with just the last portion of that comment instead of the whole thing.


    Caution: Contents may have been coded under pressure.
      i don't fully understand what that is doing. Keep in mind, in between multiple time/date entries there maybe multiple lines, the description is not necessarily all on the same line as the date/time stamp (e.g. paragraphs). But yes, a new line and a "[" is probably a fair assumption for the start of each description update. Example below.
      [Tue Oct 19 05:31:08 2004, ukaraa]: ticket:update "PercentSynced" is an important indicator showing the progress of Synchronization especially for large capacity LUN\'s. Hence changing + the urgency to U2. [Thu Jan 13 10:20:22 2005, ukaraa]: ticket:update This ticket is pending since long in a "GATD" status. Is there any p +lan to fix this ticket in current/future iterations? Thanks, - Anand [Thu Jan 13 11:16:58 2005, mmccart]: ticket:update Mike Roman is working on this now. I\'m reassigning this to him to +tie to the analysis. [Tue Mar 29 07:42:43 2005, romanm1]: ticket:update Fixed in I16 [Wed Mar 30 05:28:10 2005, ukaraa]: ticket:update Re-tested the issue with build #0.1.16.26d. After adding a clone to clone group, the "PercentSynced" now shows 0 +, 2, 100 while the initial synchronization is in progress. It changes directl +y to 100% after 2%. This behavior is seen both via CLI and NaviX UI. While the initial synchronization in progress, the "PercentSynced" + figure should change in a regular interval representing the actual percenta +ge synchronized.
        i don't fully understand what that is doing
        It's not hard to find out:
        substr
        rindex

        rindex is finding the position of the last "\n[", +1 moves past the \n, and substr is taking everything from there on. It doesn't matter what else the string contains.


        Caution: Contents may have been coded under pressure.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://447900]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (5)
As of 2024-04-24 12:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found