Hello all. I have a requirement to concatenate multiple lines of data into a single line. See example below. I have tried solutions in a transformer stage variables with no success. Any help/advise would be greatly appreciated.
Example
Input:
name age address
John|43|1015 main street
Queens
New York 10035 ^
Jackie|51|1015 main street Queens New York 10035 ^
James|50|10 Court LN
Raleigh
North Carolina 12045 ^
Output:
name age address
John|43|1015 main street Queens New York 10035 ^
Jackie|51|1015 main street Queens New York 10035 ^
James|50|10 Court LN Raleigh North Carolina 12045 ^
Concatenate multiple lines of data into a single line.
Moderators: chulett, rschirm, roy
Re: Concatenate multiple lines of data into a single line.
Shell script with a loop.
start of loop:
$line1=read the line from input;
$line2=read the line from input;
$line3=read the line from input;
echo it to the output "$line1 $line2 $line3";
end of loop
if condition the loop to beak out once you reach the end of file.
start of loop:
$line1=read the line from input;
$line2=read the line from input;
$line3=read the line from input;
echo it to the output "$line1 $line2 $line3";
end of loop
if condition the loop to beak out once you reach the end of file.
Re: Concatenate multiple lines of data into a single line.
Thank you so much PaulVL.
I'm hoping for a DataStage solution, as the the resources may not have sufficient skills to support a script solution.
I'm hoping for a DataStage solution, as the the resources may not have sufficient skills to support a script solution.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Re: Concatenate multiple lines of data into a single line.
Transformer stage with the same loop that Paul outlined.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.