Inconsistent spaces between columns

(imported topic written by bdagar)


I am trying read a file data into analyis which has inconsistent spaces between column values. To be specific the columns are left indented and the values length is different for each row. I am able to get the first column into a property but finding it difficult for the second and last column


ABC 67 lkdkkjdfhfj

DGFKJKJ 1 kjjhgffdf

AB 9876 jkkjk

I am new to the forum , any help is appreciated.

(imported comment written by jeremylam)

You can do this with regular expressions but it will vary with how the data is formatted. When there are spaces or missing columns, problems will occur. Here’s what I did in Fixlet Debugger - assuming you want to keep the columns together:

q: lines of file "C:\Users\jeremylam\Desktop\line_parsing.txt"
A: ABC 67 lkdkkjdfhfj
A: DGFKJKJ 1 kjjhgffdf
A: AB 9876 jkkjk
T: 0.341 ms
I: plural file line

q: ((parenthesized parts 1 of it, parenthesized parts 2 of it, parenthesized parts 3 of it) of matches (regex “^\s*([\w]+)\s+([\w]+)\s+([\w]+)”) of it) of (lines of file “C:\Users\jeremylam\Desktop\line_parsing.txt”)
A: ABC, 67, lkdkkjdfhfj
A: DGFKJKJ, 1, kjjhgffdf
A: AB, 9876, jkkjk
T: 0.498 ms
I: plural ( substring, substring, substring )

(imported comment written by bdagar)

Thanks Jeremy

this seems to work in debugger in my windows tem server. But on actual aix server if i run this, it returns nothing.

i have attached a few screenshots to understand the file content and the relevance results. The file has user ids and expiry details.

(imported comment written by jeremylam)

In your second query you are missing the ending quotation mark for the file object:

lines of file "/tmp/expire.out)

should be

lines of file “/tmp/expire.out”)