Page 1 of 1

embedded quotes

Posted: Wed Mar 03, 2010 3:42 pm
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

embedded quotes

Posted: Wed Mar 03, 2010 4:01 pm
by pavan_test
Is there any unix (AWK) solution available.

Please advice

Thanks
Mark

Posted: Wed Mar 03, 2010 4:03 pm
by DSguru2B
CONVERT() maybe.

Posted: Wed Mar 03, 2010 4:30 pm
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

Posted: Wed Mar 03, 2010 4:37 pm
by DSguru2B

Code: Select all

sed -e 's/"//g' -e 's/\'//g' file

Posted: Wed Mar 03, 2010 4:43 pm
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

Posted: Wed Mar 03, 2010 8:49 pm
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