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

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.

Replies are listed 'Best First'.
Re^4: Parsing a data field that is seperated by data/time entries
by TASdvlper (Monk) on Apr 14, 2005 at 19:38 UTC
    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.