Page 1 of 1

Custom Delimiters

Posted: Mon May 08, 2006 3:41 pm
by narasimha
I get a few log files which have delimiters like

Code: Select all

|.|
Is there a simple way of parsing the records, or do we have to go to the regular expression route?

Posted: Mon May 08, 2006 3:58 pm
by kcbland
If you mean column delimiter, then you could try using the pipe '|' character as the delimiter, and ignore the columns with just the decimals. Treat them as marker fields, just ignore them.

Posted: Mon May 08, 2006 4:07 pm
by narasimha
Ken,

I had tried your approach, but was curious to know if there is a way to actually use |.| as a column delimiter ??

Posted: Mon May 08, 2006 5:34 pm
by chulett
Nothing inherent to the Sequential File stage. Off the top of my head, you may be able to leverage the Filter option with perhaps 'tr' or some other command to translate your 'multiple character delimiter' into a single character. :?

Or go old school and bring in the record as one long string and then use something like Field to bust it up. I'm not saying that the Field command supports multi-character delimiters, I've never had to deal with anything like that, but it would be interesting to investigate the possibility.

Probably best to stick with Ken's approach, it seems the most... straight-forward. :wink:

Posted: Mon May 08, 2006 6:12 pm
by narasimha
Your right Craig, Ken's approach does give me the desired results.
I was looking into other possibilities, like -

Code: Select all

sed -e 's/|.|/|/g'
works perfectly on the OS level, but it complains when I put it in the Filter Command.

Posted: Mon May 08, 2006 7:31 pm
by chulett
And the complaint would be?

Posted: Tue May 09, 2006 1:04 pm
by narasimha
I get the error

Code: Select all

LogFile..Copy_of_Sequential_File_0.DSLink3: ds_seqopen() - Error in filter command "/usr/bin/sed -e 's/" - 
sed: Function s/ cannot be parsed.

LogFile..Copy_of_Sequential_File_0.DSLink3: DSD.SEQOpen GCI $DS.SEQOPEN error 11.

Posted: Tue May 09, 2006 1:49 pm
by DSguru2B
Try it in the before job subroutine.

Posted: Tue May 09, 2006 1:54 pm
by rwierdsm
narasimha,

I'd be very interested in your eventual solution. I will be receiving some files that have multiple 32k wide columns separated by a 3 character delimiters.

Please post your findings!