Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

divide string with various number of spaces into tokens

Hi!

I have a .txt file (log file) which is not delimited in any way, and I have to identify 6 columns which are numeric:

------

                Total    Copied   Skipped  Mismatch    FAILED    Extras

     Dirs :     67051        49     67002         0         0        10

    Files :    412570       410    412160         0         0        51

    Bytes : 648.587 g   1.124 g 647.463 g         0         0  123.24 m

    Times :   1:38:52   0:14:14                       0:00:00   1:24:37

    Speed :             1412267 Bytes/sec.

    Speed :              80.810 MegaBytes/min.

    Ended : Tue Mar 20 19:09:05 2012

-------

The information I'm interested in are the 6 columns of the Dirs, Files, Bytes and Times.

The problem are the spaces between the numbers (which are not constant - every log file has different number of spaces bacuse of the difference in the numbers).

I coudln't do it using index(), purgechar() or even subfield() because there's a difference between ' ' and '    '.

I thought about even creating a loop and transforming every group of spaces to one space (or any other divider i.e. : ; - /) but i'm not sure how to do it.

Can you assist? Thanks in advance!

Montal.

6 Replies
SunilChauhan
Champion II
Champion II

extract file using table file in edit script

when extract then at first you have one option in fisrt window

delimeter and in that you can choose seperator and load

hope this helps you

Sunil Chauhan
Not applicable
Author

Hi.

I didn't quite understand what exactly should I do.

There is no seperator in the .txt file, and there is a difference (as far as Qlikview parser works) between a single space ' ' and multiple spaces '      '.

SunilChauhan
Champion II
Champion II

can share sample txt file?

Sunil Chauhan
Not applicable
Author

------

                Total    Copied   Skipped  Mismatch    FAILED    Extras

     Dirs :     67051        49     67002         0         0        10

    Files :    412570       410    412160         0         0        51

    Bytes : 648.587 g   1.124 g 647.463 g         0         0  123.24 m

    Times :   1:38:52   0:14:14                       0:00:00   1:24:37

    Speed :             1412267 Bytes/sec.

    Speed :              80.810 MegaBytes/min.

    Ended : Tue Mar 20 19:09:05 2012

-------

Not applicable
Author

Any ideas?

Not applicable
Author

Eventually I did it with FOR /F before the data was even loaded into the Qlikview.

Thanks anyway,

Montal.