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

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
georgheretis
Participant
Posts: 5
Joined: Wed Oct 24, 2012 7:24 am

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

Post 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.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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/[ ;]*$//'"
georgheretis
Participant
Posts: 5
Joined: Wed Oct 24, 2012 7:24 am

Post 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
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Post by BI-RMA »

You can also tell DataStage on the Sequential File Stage what exactly your row delimiter is.
For example RecordDelimiterString=;\n
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post 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?
chillblue
Premium Member
Premium Member
Posts: 13
Joined: Mon Sep 19, 2011 11:58 pm
Location: Michigan

Post by chillblue »

Hi ,


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


This will remove the last occurrence of ";".
Thanks
Chillblue
Post Reply