Page 1 of 1

comma delimeted files

Posted: Wed Dec 28, 2005 1:04 am
by kkreddy
hi guru's
i have a senerio where in the ", " delimeted seq file ,inside the column contains "," like
001,ravi,kumar,98
002,ramkumar,34

could u please let me know is there any whay to solve this
Thanks in advance

KKReddy

Re: comma delimeted files

Posted: Wed Dec 28, 2005 1:15 am
by loveojha2
Read a whole line as a single column, you can achieve this with having 000 as the quote character and 010 as the delimiter. Now process this single column according to the requirement.
kkreddy wrote:hi guru's
i have a senerio where in the ", " delimeted seq file ,inside the column contains "," like
001,ravi,kumar,98
002,ramkumar,34

could u please let me know is there any whay to solve this
Thanks in advance

KKReddy

Posted: Wed Dec 28, 2005 1:18 am
by loveojha2
Its not easy even with a single column, since you are not sure of the field boundaries.

Posted: Wed Dec 28, 2005 1:56 am
by kcshankar
Hi,

Is your source file have similar pattern,ie delimiter variation is only in the second/string field.

Code: Select all

001,ravi,kumar,98 
002,ramkumar,34 
Assuming u want output to be like this below,
001,ravikumar,98
002,ramkumar,34

Define ur source file with 000 delimiter -single Column.

Declare StageVariable to hold the count of ","
DCount (string, delimiter)


For 1st record
Use Field ("Source"string, ",", 1)

For Last Record
Use Field ("Source"string, ",", (StageVariable))


For 2nd record
Trim((Iconv("Source", "MC/N")),",""A")


Regards
kcs