Removal of Special Character
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 14
- Joined: Wed May 05, 2010 1:24 am
Removal of Special Character
Can anybody tell how to remove special characters from a string in DataStage?
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 14
- Joined: Wed May 05, 2010 1:24 am
Removal of Special Character
Yes I do have permission of the owner. This was the smal requirement to do AphaNumeric comparision on two columns. So thats why I was trying to remove special characters from the column
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 14
- Joined: Wed May 05, 2010 1:24 am
Use external filter
Code: Select all
Filter command : sed "s/[^0-9A-Za-z]//"
You are the creator of your destiny - Swami Vivekananda
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Philosophically, they're not special, they're just non alphanumeric.
Code: Select all
Convert("!@#$%^&*()_-+={}[]|\:;'?><,./~`" : '"', "", InLink.TheString)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 14
- Joined: Wed May 05, 2010 1:24 am
You mean other than what people have already posted?
Think about what it is you need to accomplish, you should be able to solve this. You can either build a list of everything you want to delete and then do so (one of the solutions posted) or build a list of everything you want to keep and then delete everything else (the other solution posted). If you want to do this all "in DataStage" the same function can be used for both - Convert() - with one being a little simpler than the other while the 'better' solution (the latter, IMHO) is a little trickier but will be quite interesting and easy to understand once you see it.
Give this a shot and let us know if you have any specific questions.
ps. Both methodologies and the whole issue of "special" characters have been discussed here ad nauseam. A proper Exact Match search should turn them up.
Think about what it is you need to accomplish, you should be able to solve this. You can either build a list of everything you want to delete and then do so (one of the solutions posted) or build a list of everything you want to keep and then delete everything else (the other solution posted). If you want to do this all "in DataStage" the same function can be used for both - Convert() - with one being a little simpler than the other while the 'better' solution (the latter, IMHO) is a little trickier but will be quite interesting and easy to understand once you see it.
Give this a shot and let us know if you have any specific questions.
ps. Both methodologies and the whole issue of "special" characters have been discussed here ad nauseam. A proper Exact Match search should turn them up.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers