double quotes
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 263
- Joined: Fri Sep 23, 2005 6:49 am
double quotes
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
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
-
- Participant
- Posts: 27
- Joined: Thu Mar 20, 2008 11:55 am
Try this...
sed 's/[""]//g' oldFilename>Newfilename
I missed [] in my previous post...
sed 's/[""]//g' oldFilename>Newfilename
I missed [] in my previous post...
Last edited by filename.txt on Mon Aug 25, 2008 4:05 pm, edited 2 times in total.
Thanks.
"Creativity is the ability to use your available resources to their fullest."
"Creativity is the ability to use your available resources to their fullest."
-
- Premium Member
- Posts: 263
- Joined: Fri Sep 23, 2005 6:49 am
double quotes
[quote="filename.txt"]Try...
sed 's/""/,//g'<oldfilename>newfilename[/quote]
it says sed: Function s/""/,//g cannot be parsed.
Thanks
Mark
sed 's/""/,//g'<oldfilename>newfilename[/quote]
it says sed: Function s/""/,//g cannot be parsed.
Thanks
Mark
-
- Premium Member
- Posts: 263
- Joined: Fri Sep 23, 2005 6:49 am
double quotes
[quote="filename.txt"]Try...
sed 's/""/,//g'<oldfilename>newfilename[/quote]
it says sed: Function s/""/,//g cannot be parsed.
Thanks
Mark
sed 's/""/,//g'<oldfilename>newfilename[/quote]
it says sed: Function s/""/,//g cannot be parsed.
Thanks
Mark
-
- Participant
- Posts: 27
- Joined: Thu Mar 20, 2008 11:55 am
-
- Premium Member
- Posts: 263
- Joined: Fri Sep 23, 2005 6:49 am
double quotes
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
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
-
- Premium Member
- Posts: 783
- Joined: Mon Jan 16, 2006 10:17 pm
- Location: Sydney, Australia
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 " .
'"' is single quote:double quote:single quoteTrim(<column name>,'"')
Last edited by keshav0307 on Tue Aug 26, 2008 12:13 am, edited 1 time in total.
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
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.
For example try
Code: Select all
perl -pi -e 's/<old text>/<new text>/g;'
As only one column is with quotes, you can always use datastage functions to remove special charecters , which avoids one unix script stage.
Thanks, BK
-
- Premium Member
- Posts: 263
- Joined: Fri Sep 23, 2005 6:49 am
double quotes
Thanks for all the suggestions.
it is working now.
Thanks
Mark
it is working now.
Thanks
Mark