Page 1 of 1

Reading a file using sequential file stage

Posted: Tue Nov 30, 2010 7:28 am
by mallikachaithu
Hi,

I have text file which has multiple seperators in the data. (i.e the data consists of comma separator, space seprator in the same file)
I want to read this file using sequential file stage.
Can you guys help me how can i proceed.

Thanks

Posted: Tue Nov 30, 2010 7:31 am
by chulett
Can you post some examples of records from that file? :?

You'll probably need to read the record as a single long varchar field and then parse it "manually" but examples would help provide better direction.

Posted: Tue Nov 30, 2010 1:20 pm
by ray.wurlod
Consider using Field Delimiter String property.

Posted: Tue Nov 30, 2010 3:31 pm
by epmenard
OR another option is to use tr or sed as unix command in a pre-job subroutine to replace one of the separators by the other allowing a read using a single separator value

Posted: Thu Dec 02, 2010 5:11 am
by mallikachaithu
Hi Chulett,

The file is like

111, "Mallika", India
121 "Chaithu" US
123, "Krishna", China

in the above file i have comma separated data in row-1 and space separated data in row-2.
So this file i want to read.

Re: Reading a file using sequential file stage

Posted: Thu Dec 02, 2010 7:42 am
by sachinag
Hi,

Read ur file with a delimiter that u think will not come in ur file as a delimiter,this will read record in ur file as a single column.

If you want to create the different files of same delimiter we can do that also using a transformer and count function in the constraint.

Regards
Sachin Gupta

Posted: Thu Dec 02, 2010 8:52 am
by chulett
Of course, another option is to get whomever or whatever is producing that file to build a valid csv file rather than junk like that. :?

Re: Reading a file using sequential file stage

Posted: Thu Dec 02, 2010 1:37 pm
by ray.wurlod
sachinag wrote:Hi,

Read ur file with a delimiter that u think will not come in ur file as a delimiter,this will read record in ur file as a single column.

If you want to create the different files of same delimiter we can do that also using a transformer and count function in the constraint.

Regards
Sachin Gupta
The second person personal pronoun is spelled "you" in English, or "your" in possessive case.

Please eschew SMS-style abbreviations and prefer professional written English on DSXchange.