Conversion of any delimited row to Pipe delimited

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
chaithanya
Participant
Posts: 12
Joined: Fri Apr 12, 2013 7:12 am

Conversion of any delimited row to Pipe delimited

Post by chaithanya »

Hi

I have a row with data as follows

abc|xyz|a,b,c,d|123

I need the demiter comma to be replaced by Pipe as follows


abc|xyz|a|b|c|d|123 :D
prasson_ibm
Premium Member
Premium Member
Posts: 536
Joined: Thu Oct 11, 2007 1:48 am
Location: Bangalore

Post by prasson_ibm »

Hi,
If your source is sequential file,it can be done in different methods:-

Method 1:-

Read seq. file as a single string and apply convert function in transformer.
Convert(",","|",InputLink.Col)

Method2:-

In the input sequential file stage,write below sed command at Option->Filter

sed '1,$s/,/|/g'
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The tr command is cheaper to run than sed.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply