Page 1 of 1

How to remove delimiter (;) from the end of a csv file

Posted: Fri Nov 02, 2012 3:03 am
by georgheretis
How to remove delimiter (;) from the end of a csv file , when the csv file is a source. I need to do for a field in a transfrormation in order to remove the delimiter at the end.

Posted: Fri Nov 02, 2012 3:27 am
by ArndW
If the ";" is also a field delimiter then you can either add a dummy "FILLER" field to your column definitions or you can use the "filter" in your sequential stage to remove that trailing semicolon from you data stream using something like "sed 's/[ ;]*$//'"

Posted: Fri Nov 02, 2012 4:22 am
by georgheretis
Due to the fact that I am using only one transformation stage , is it possible to use the 'replace' or something else in order to remove the delimiter

Posted: Fri Nov 02, 2012 4:54 am
by BI-RMA
You can also tell DataStage on the Sequential File Stage what exactly your row delimiter is.
For example RecordDelimiterString=;\n

Posted: Fri Nov 02, 2012 5:57 am
by ArndW
Could you explain your problem a bit more - is the semicolon actually your field delimiter character and is this character being placed in the last column?

Posted: Fri Nov 02, 2012 11:48 am
by chillblue
Hi ,


try using Trim(column,";","T") in transformer stage.


This will remove the last occurrence of ";".