embedded quotes

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
pavan_test
Premium Member
Premium Member
Posts: 263
Joined: Fri Sep 23, 2005 6:49 am

embedded quotes

Post by pavan_test »

Hi All,

How do I get rid of embedded double quotes and single quotes in the data.

Incoming data: ' '"WASH BAy" SATIN' '

output data: 'WASH BAy SATIN'

Thanks
Mark
pavan_test
Premium Member
Premium Member
Posts: 263
Joined: Fri Sep 23, 2005 6:49 am

embedded quotes

Post by pavan_test »

Is there any unix (AWK) solution available.

Please advice

Thanks
Mark
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

CONVERT() maybe.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Code: Select all

tr -d \" < file

Code: Select all

awk -v qt='"' ' { gsub(qt,"") } 1 ' file

Code: Select all

sed 's/"//g' file
You are the creator of your destiny - Swami Vivekananda
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Code: Select all

sed -e 's/"//g' -e 's/\'//g' file
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

anbu wrote:

Code: Select all

tr -d " < file

Code: Select all

awk -v qt='"' ' { gsub(qt,"") } 1 ' file

Code: Select all

sed 's/"//g' file
This removes both single and double quotes

Code: Select all

tr -d "\' < file

Code: Select all

awk -v singleQt=\' -v dblQt=" ' { gsub(dblQt,"");gsub(singleQt,"") } 1 ' file
You are the creator of your destiny - Swami Vivekananda
Kryt0n
Participant
Posts: 584
Joined: Wed Jun 22, 2005 7:28 pm

Post by Kryt0n »

Can't imagine there is an easy UNIX solution to removing embedded quotes... getting rid of all quotes is possible (as has been provided) or in DataStage use the convert with one column per row...

To handle purely the embedded quotes a Server job should be able to do the trick
Post Reply