Page 1 of 1

Same lookup on multiple rows

Posted: Mon Jan 17, 2022 6:59 am
by Yarobi
Hello all,

I have a sequential input file with + 100 lines.
But there are codes in these lines and I need to replace them with numbers.


Is there an easy way to do this?

Codes : MS = 8,1 / AS = 8,1 / N = 9 / WEN = 11 / WED = 11 / N-TW = 9

input:
ID 1 2 3 4 5 6 7
650692063 MS MS MS MS MS
780844037 WEN WEN AS AS AS
980657973 AS AS N
611016639 MS MS MS MS MS
640574862 AS AS AS AS AS
980407793 AWN AWN N N N N
790634771 MS MS MS MS MS
600471729 AS AS AS AS AS
931126541 MS MS MS MS MS
791051871 WED WED AS AS AS AS AS
680128937 MS MS MS
690981015 MS MS MS MS MS
620631662 AS AS AS AS AS
900351471 N-TW N-TW N-TW N-TW N-TW
750439183 AS AS AS AS AS
840596239 AWD AWD MS MS MS MS MS

Return should be like

ID 1 2 3 4 5 6 7
650692063 8,1 8,1 8,1 8,1 8,1
780844037 11 11 8,1 8,1 8,1
980657973 8,1 8,1 9
...

Re: Same lookup on multiple rows

Posted: Fri Jan 21, 2022 11:31 am
by PaulVL
Since it is a sequential file to begin with, I would do it from a command line and not DataStage logic.

https://stackoverflow.com/questions/132 ... ell-script

sed command for string replace and make it with the /g option