Author Topic: Parsing semi-structure text file  (Read 1512 times)

bachphi

  • Hero Member
  • *****
  • Posts: 671
    • View Profile
Parsing semi-structure text file
« on: June 17, 2017, 05:02:24 PM »
I have a result text file, it's sort of semi-structured text file. To simplify the problem, I will focus to TestPoints only. Within the file, there are many TestPoints Tp[x ] , but I am only interested in the first 10. And within a TestPoint , there are many items like Speed, RailPressure, ZeroPointPressure,.... again to simplify, I am only interested in Speed and ZeroPointPressure.
so for Tp[1], Speed = "0.100000"   and ZeroPointPressure =  "0.200000".

I would love to see it display in a gridview or so
Tp   Speed   ZeroPointPressure
1   "0.100000"   "0.200000"
2   "0.300000"   "0.400000"

and eventually  send to a SQL as one record ("0.100000","0.20000","0.300000","0.400000",...)

Thanks in advance.



--------------------------------------------------------------------------------
...
...

  Tp[1] #Index
    StructName = "ResultDataTPStruct"
    PositionType
      VarType = REG_DWORD 0x3
      Data = "4"
    NioRepeating
      VarType = REG_DWORD 0x3
      Data = "0"
    Variante
      VarType = REG_DWORD 0x3
      Data = "0"
    Speed
      StructName = "TdResultReal"
      Value
        VarType = REG_DWORD 0x4
        Data = "0.100000"
      Result
        VarType = REG_DWORD 0x3
        Data = "1"
      LoLim
        VarType = REG_DWORD 0x4
        Data = "-2.000000"
      UpLim
        VarType = REG_DWORD 0x4
        Data = "2.000000"
      CheckType
        VarType = REG_DWORD 0x3
        Data = "4"
    Railpressure
      StructName = "TdResultReal"
      Value
        VarType = REG_DWORD 0x4
        Data = "18.000000"
      Result
        VarType = REG_DWORD 0x3
        Data = "1"
      LoLim
        VarType = REG_DWORD 0x4
        Data = "-20.000000"
      UpLim
        VarType = REG_DWORD 0x4
        Data = "20.000000"
      CheckType
        VarType = REG_DWORD 0x3
        Data = "4"
    ZeroPointPressure
      StructName = "TdResultReal"
      Value
        VarType = REG_DWORD 0x4
        Data = "0.200000"
      Result
        VarType = REG_DWORD 0x3
        Data = "0"
....
...
  Tp[2] #Index
    StructName = "ResultDataTPStruct"
    PositionType
      VarType = REG_DWORD 0x3
      Data = "1"
    NioRepeating
      VarType = REG_DWORD 0x3
      Data = "0"
    Variante
      VarType = REG_DWORD 0x3
      Data = "0"
    Speed
      StructName = "TdResultReal"
...
-----------------------------------------------------------------------------------------
===================================================
This is NOT alt.read.my.mind.
No such thing is sh^t-for-brains unless you are posting to alt.read.my.mind.
===================================================