Page 1 of 1

Row splitting

Posted: Thu Nov 17, 2005 2:25 am
by snassimr
Hi !

I have long string I need to split it with defined delimitor
and output multiple rows to seq file.

How to do it ?

Posted: Thu Nov 17, 2005 2:42 am
by ArndW
Snassimr,

there are several very different ways to do this that depend upon your data. Does the string already contain the delimiters or do you want to break it up into chunks of length n; is the string of fixed length?

Have you looked into using the row splitter stage and why do you feel you can't use it?

Posted: Thu Nov 17, 2005 3:47 am
by snassimr
Row splitter do from row several columns but its one rrecord . I need the string parse for many records with one column and the value is separated with '\\\'

Posted: Thu Nov 17, 2005 4:22 am
by ArndW
Could you give us a sample input row and output row?

Posted: Thu Nov 17, 2005 4:30 am
by snassimr
input

Value1\\\Value2\\\Value3\\\Value4

Output requered :

Value1
Value2
Value3
Value4

As 4 rows with one column each

Posted: Thu Nov 17, 2005 5:21 am
by ArndW
Write a Transform with a derivation "EReplace(In.Column,'\\\',CHAR(010))" to replace all occurrences of '\\\' with a single LF. Write this to a sequential file or pipe with no formatting - no quotes or separators and use the UNIX style line termination. Then read the file and it will be in the format you desire.

Posted: Thu Nov 17, 2005 5:51 am
by srinagesh
or.. if you dont want to do so many steps... use Rowsplitter and then pivot it

Hope it helps

Nagesh