Page 1 of 1

double quotes

Posted: Mon Aug 25, 2008 3:33 pm
by pavan_test
Hi All,

I have a file with 1 column and its data is as follows;
"Happy Hour, Party on 18"" staged on 20th."

Can anyone please suggest me how do I remove the embedded quote in data stage while reading this column.
awk or sed might be able to do the trick using external filter stage. but i am not sure how to accomplish this.

can anyone please suggest me.

Thanks
Mark

Posted: Mon Aug 25, 2008 3:48 pm
by filename.txt
Try this...

sed 's/[""]//g' oldFilename>Newfilename

I missed [] in my previous post...

double quotes

Posted: Mon Aug 25, 2008 3:52 pm
by pavan_test
[quote="filename.txt"]Try...

sed 's/""/,//g'<oldfilename>newfilename[/quote]

it says sed: Function s/""/,//g cannot be parsed.

Thanks
Mark

double quotes

Posted: Mon Aug 25, 2008 3:53 pm
by pavan_test
[quote="filename.txt"]Try...

sed 's/""/,//g'<oldfilename>newfilename[/quote]

it says sed: Function s/""/,//g cannot be parsed.

Thanks
Mark

Posted: Mon Aug 25, 2008 4:05 pm
by filename.txt
Try this...

sed 's/[""]//g' oldFilename>Newfilename

I tested it and it should work :)

I missed [] in my previous post...

double quotes

Posted: Mon Aug 25, 2008 6:17 pm
by pavan_test
Thank you. This is working partially.

Before;

"Happy Hour, Party on 18"" staged on 20th."

After;

Happy Hour, Party on 18 staged on 20th.

My Expected result;

Happy Hour, Party on 18" staged on 20th.

Can anyone please suggest me how do I implement this in data stage. what stage do I have to use to acomplish this.

Thanks a lot.

Thanks
Mark

Posted: Mon Aug 25, 2008 10:53 pm
by keshav0307
it is quite simple. read the whole string with quotes (in the file stage set quote=none) and then in a transformer stage trim the " .
Trim(<column name>,'"')
'"' is single quote:double quote:single quote

Posted: Mon Aug 25, 2008 11:24 pm
by tkbharani
You must redirect the file output incase you opt to use sed or awk. Rather try to use perl command to find & replace in the same file without redirecting. Incase if the file is large, perl -pi will be much faster than sed.
For example try

Code: Select all

perl -pi -e 's/<old text>/<new text>/g;'
Other Option
As only one column is with quotes, you can always use datastage functions to remove special charecters , which avoids one unix script stage.

double quotes

Posted: Tue Aug 26, 2008 7:53 am
by pavan_test
Thanks for all the suggestions.

it is working now.

Thanks
Mark