Parsing a text file with a fixed format with multiple lines

I am trying to parse some data in a text file with a fixed format, where each "record" is spread over several lines, since ...

 MAILBOX: 10013      Created: 01/20/09  4:39 pm
    MSGS: 0         UNPLAYED: 0           URGENT: 0          RECEIPT: 0
  LCOS: RBC Standard    : 20            FCOS: RBC Standard      : 20 
  GCOS: Default GCOS 1  : 1             NCOS: Default           : 1 
  TCOS: Default TCOS 1  : 1             RCOS:                   : 1 
BAD LOGS: 0         LAST LOG: NEVER                             MINS:      0.0
  PASSWD: Y            TUTOR: N              DAY: M            NIGHT: M       
    NAME:                                   CODE: 
   EXTEN: 10013                            INDEX: 0
ATTEN DN:                                  INDEX: 0         
DISTRIBUTION LISTS WITH CHANGE RIGHTS:
    all
DISTRIBUTION LISTS WITH REVIEW RIGHTS:
    all

I used File Helpers before for single entries, and it was very useful. Checking his documentation, he has a function MultiRecordEngine, but that will mean ...

  • class for each row ... no problem
  • calculating the exact size of each fixed-format field ... painful and error-prone
  • to check each line

, , - , , .. , 21 , 22, 23, 24 ..

Java, FFP, - .NET, #, PowerShell

?

+5
2

. , , , .

/ . . Gold .

lexing/parsing PowerShell. # F # PowerShell.

: FileHelpers. Multirecord Engine .NET, . , , .

+4

All Articles