Question

how do i a split single file into two separate datasets. see details below.

  • 16 January 2024
  • 2 replies
  • 4 views

I have a data file that contains the following data records:

 

Date:  28/06/22 Time:  18:40:40 Version: 9.10

Events: Y Relays: I Evlog: Y Buftyp: C Bufsiz:  829

Cond:  100 100 100 100 100 100 100 100

Ch: 1  En: Y  Ut: 30  Dt: 30  Uc: 3999  Dc: 995  Sa: 31  Wa: 31

Ch: 2  En: Y  Ut: 25  Dt: 25  Uc:  3  Dc:  1  Sa: 57  Wa: 57

Ch: 3  En: N  Ut: 30  Dt: 30  Uc:  0  Dc:  0  Sa: 37  Wa: 37

Ch: 4  En: Y  Ut: 30  Dt: 30  Uc: 2790  Dc: 439  Sa: 33  Wa: 33

24/06/22 20:08:47 100 4 U 033 

24/06/22 20:08:57 100 4 U 040 

24/06/22 20:34:23 100 4 U 042 

24/06/22 20:34:35 100 4 U 037 

 

How do I split this data file into two separate datasets e.g.

 

Dataset #1:

Date:  28/06/22 Time:  18:40:40 Version: 9.10

Events: Y Relays: I Evlog: Y Buftyp: C Bufsiz:  829

Cond:  100 100 100 100 100 100 100 100

Ch: 1  En: Y  Ut: 30  Dt: 30  Uc: 3999  Dc: 995  Sa: 31  Wa: 31

Ch: 2  En: Y  Ut: 25  Dt: 25  Uc:  3  Dc:  1  Sa: 57  Wa: 57

Ch: 3  En: N  Ut: 30  Dt: 30  Uc:  0  Dc:  0  Sa: 37  Wa: 37

Ch: 4  En: Y  Ut: 30  Dt: 30  Uc: 2790  Dc: 439  Sa: 33  Wa: 33

 

Dataset #2:

24/06/22 20:08:47 100 4 U 033 

24/06/22 20:08:57 100 4 U 040 

24/06/22 20:34:23 100 4 U 042 

24/06/22 20:34:35 100 4 U 037 

 

Please advise.


2 replies

Userlevel 6
Badge +34

One way to do this is to read the file as text. Then use anything you need to determine where the seperation lies. Something like text_line_data contains / or if the header is always 7 rows, the rownumber. Then write out to two different files. If you use a FeatureWriter and a FeatureReader, you will be able to read the second part with a csv reader. As an alternative you can skip the write and read csv step by splitting the columns using an attributesplitter.

Userlevel 6
Badge +34

One way to do this is to read the file as text. Then use anything you need to determine where the seperation lies. Something like text_line_data contains / or if the header is always 7 rows, the rownumber. Then write out to two different files. If you use a FeatureWriter and a FeatureReader, you will be able to read the second part with a csv reader. As an alternative you can skip the write and read csv step by splitting the columns using an attributesplitter.

Something like this.

Reply