Hi All,
Below is my source file format.
Account name,city,value
ABC,hyd,1000
DEF,ban,2000
ABC,Chn,3000
GHI,US,3000
JKL,UK,4000
DEF,us,6600
I need to find unique records I. Account name column and all unique records to populate in single line like below.
Output:
/'ABC/',/'DEF/',/'GHI/',/'JKL/'
Please let me know how to get the desired output.
Unique records into single line
Moderators: chulett, rschirm, roy
Create a DataStage job to sort/unique followed by Vertical Pivot on first column; replace delimiters as needed.
This can also be done in External Source stage or external filter of Sequential File stage by passing following command:
This can also be done in External Source stage or external filter of Sequential File stage by passing following command:
Code: Select all
awk -F',' '{print $1|"sort -u"}'|awk '{printf "/'"'"'" $1} END {print "/'"'"'"}'
As Craig noted above, the requirement seems to have changed. For initial requirement try You can also code a dataStage job for this/these req (see previous post).
Code: Select all
awk -F',' '{print $1|"sort -u"}'|awk 'BEGIN {SS=PS="/'"'"'"}{if (NR>1){PS="," SS}} {printf PS $0 SS}'