One Star

replace string on whole input line

Hi,
I'd like to replace strings on the whole input line in one step. Is this possible?
My file has >100 columns so I guess it was a performance drawback to replace them column by column.
Thanks
Guenter
6 REPLIES
Community Manager

Re: replace string on whole input line

Hello
Can you give us an example to expain your problem?
Does the tFileInputFullRow fit your need? It read the whole line as a column.
Best regards

shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: replace string on whole input line

Example:
Input row structure:
Text1;Float1;Text2;Text3;.Float2;Float3;Int1;Time1;...;Text130;...Textn
The input consists of hundreds of columns. Since the text fields can contain unwanted characters like | & @ \n I need to replace them by other characters.
After replacement I have to process the rows column by column.
So my request is to do the replacement on the complete input row in one step regardless of the structure.
tFileInputFullRow provides the whole row as one string but:
1. input rows may contain \n (enclosed by " according to rfc4180)
2. how can I map the complete row(=1 string) to the columns needed for further processing?
Other ideas:
1) Is it possible to read the file line by line, do the replacement, write the lines to an in-memory-file and open the in-memory-file with the tFileInputDelimited component?
2)
- use sed in a tSystem-component for replacement
- read the sed-output via a pipe
Is this possible?
Thanks
Guenter
One Star

Re: replace string on whole input line

I have exactly this problem (as per the most recent message which doesn't look like it was ever answered) - any idea what the best solution is?
Thanks very much
One Star

Re: replace string on whole input line

Same problem here. Any hints?
One Star

Re: replace string on whole input line

Read each row as a single data item and do the replace on that.
Seven Stars

Re: replace string on whole input line

tFileInputFullRow --> tReplace --> tExtractDelimitedFields -->
or
tFileInputDelimited --> tJavaRow --> using reflection to cycle through the fields and do your replace (see http://www.talendforge.org/forum/viewtopic.php?id=14940)