Ad Widget

Collapse

Extract data from multiline Item to dependent Items

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prasad_SL
    Member
    • May 2018
    • 35

    #1

    Extract data from multiline Item to dependent Items

    Hi,

    I have following Item



    hardDiskUsage ServerA / {

    totalDiskSpace "10190136 KBytes";

    freeDiskSpace "4783956 KBytes";

    usedDiskSpace 53%;

    role primary;

    syncStatus unprotected;

    syncCompletion n/a;

    }

    hardDiskUsage ServerB / {

    totalDiskSpace "126371648 KBytes";

    freeDiskSpace "111609088 KBytes";

    usedDiskSpace 12%;

    role primary;

    syncStatus unprotected;

    syncCompletion n/a;

    }


    Need to extract usedDiskSpace of ServerA and ServerB to 2 Items.
    No luck with regex;

    ServerA \/\s+\{(\n\n.*){3} usedDiskSpace (.*)%
    \2

    ServerB \/\s+\{(\n\n.*){3} usedDiskSpace (.*)%
    \2

    But expected result generate in online tools (Ex: rubular.com)


    Any Advice ?


  • prasad_SL
    Member
    • May 2018
    • 35

    #2
    hi,

    just figured it out ...

    its not \n nor \r ; I have to use \s


    Regex step 01

    ServerA \/\s+\{\s+(.*)\s+(.*)\s+(.*)\s+(.*)\s+(.*)\s+(.*)

    \1 totalDiskSpace "10190136 KBytes";
    \2 freeDiskSpace "4783956 KBytes";
    \3 usedDiskSpace 53%;

    Regex step 02

    freeDiskSpace "(.*) KBytes";
    \1

    Data type Numeric; so you can directly plot.

    Comment

    • KarlHoffman
      Junior Member
      • Oct 2018
      • 1

      #3
      Your rundown has forming turned on. Additionally the multi line field has "Append just changes" setting on. So that is the reason you are getting just the most recent value in the field. achieve essays

      Comment

      Working...