Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have requirement to replace every even occurrences of comma with pipe-
from "a","b","c","d" to "a","b"|"c","d"
from "a","b","c","d","e","f" to "a","b"|"c","d"|"e","f"
How can I achieve the above in talend.
I assume your data is in a flat file. So first you need to read it in. For this I would use the tFileInputFullRow. Then in a tMap (or tJavaFlex, tJavaRow), you can use code like this....
row1.line.replace(',','|')
.... to replace the values. In the tMap the code above would just be put in the output column, for a the Java components you will need to assign that value to an output column with code.
Alternatively (assuming you are wanting to process the data), read the data in with a tFileInputDelimited using a comma as separator, process it and output it with a tFileOutputDelimited using a pipe as a separator.