Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
How to write regular expression in tmap.
Source column data.
02 04OCT 10:48:16 220001 .
Output:
col1 col2 col3 col4
02, 04OCT, 10:48:16, 220001
Thanks
Shree
Hi @Chirgal,
I have tested problem is, the source is coming with single space and multiple space.
So it create mutiple columns unnecessary and some records moving next columns.
Ex:
input:
colun1
12 <space>
13 <space><space> 26
output:
colu1 col2 col3 col4
12 <space>
13 <space> <space> 26
Thanks
Shree
First try to read whole line into single column using TfileInputFullRow.
Then use tmap to replace multiple space to single space. Source_col.trim().replaceAll("\\s+", "\\s");
After that use TExtractDelimitedFields to split the column based on space to multiple columns.
Got some idea?
Sorry. I don't have access to studio. Cant attach job or snaps
Hi @Chirgal,
Sure, TfileInputFullRow ----> tmap --> tfileoutputfiledelimited.
I am getting values multiple space and single space with "s".
Ex:
colu:
02 24OCT 10:57:37
Output:
02s24OCTs10:57:37s4246899014
How to replace "s" wiht space or any other delimiter. Before jumping to TExtractDelimitedFields.
Or, using TExtractDelimitedFields it will handle "s" values between fileds?
Thanks
Shree
Hi @Chirgal,
Everything is fine, challenge i am facing column issue. Please check below example.
Ex: Source data
12 <space> 03oct <space>13:21:21 <space> <space> 121212 ...
13 <space> 05oct <space>12:2:11 <space> 0101 <space> 121212 ...
Intermediate result after removing multiple space.
colum1:
12s03octs13:21:21s121212s...
13s05octs12:2:11s0101s121212s...
Current output am getting
col0 col1 col2 col3 .. col4
12 03oct 13:21:21 121212 ...
13 05oct 12:2:11 0101 121212 ...
Expected ouptut
col0 col1 col2 col3 col4
12 03oct 13:21:21 121212 ...
13 05oct 12:2:11 0101 121212 ...
Thanks
Shree
Hi Chirgal,
No, If you ask me length of the columns is fixed: No,
i am tried with regex and positional file. it not working as expecting.
Same issue with <space>
Thanks
Shree