Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
globalMap.put("result",row1.a);
int substring_index=0;
String result=(String)globalMap.get("result");
String b=(String)globalMap.get("row2.b");
if(result.contains(b)){
substring_index=result.indexOf(row2.b);
globalMap.put("result",result.substring(0,substring_index)+result.substring(substring_index+b.length()));
}
Starting job ddf at 13:52 18/11/2013.
connecting to socket on port 4026
connected
day
lucky
writeyour
disconnected
Job ddf ended at 13:52 18/11/2013.
globalMap.put("result",row1.a);
int substring_index=0;
String result=(String)globalMap.get("result");
String b=(String)globalMap.get("row2.b");
if(result.contains(b)){
substring_index=result.indexOf(row2.b);
globalMap.put("result",result.substring(0,substring_index)+result.substring(substring_index+b.length()));
}
Starting job ddf at 13:52 18/11/2013.
connecting to socket on port 4026
connected
day
lucky
writeyour
disconnected
Job ddf ended at 13:52 18/11/2013.
Hi
There is no a specialized component to do this, the solution is to read each line from File A, and then iterate each line from File B, and write a piece of Java code remove the same string from File A, the job is showed in my screenshot.
on tJava_1, put the current record from A to a global variable.globalMap.put("result",row1.a);
on tJava: write a piece of Java code to check if the string from A contains the same substring in B, and remove the substring, for example:int substring_index=0;
String result=(String)globalMap.get("result");
String b=(String)globalMap.get("row2.b");
if(result.contains(b)){
substring_index=result.indexOf(row2.b);
globalMap.put("result",result.substring(0,substring_index)+result.substring(substring_index+b.length()));
}
on tFixedFlowInput_3, output the end result after all iteration on records from B.
result:Starting job ddf at 13:52 18/11/2013.
connecting to socket on port 4026
connected
day
lucky
writeyour
disconnected
Job ddf ended at 13:52 18/11/2013.
Shong