Link to home
Start Free TrialLog in
Avatar of jl66
jl66Flag for United States of America

asked on

change fields with sed or awk

Have a file like the following:

10, X1'100', A, X1'200',C
20, X1'300',B, ,D
30, X1'400', X1'500',F,G
...
Want to revise it to
10, Y2'(100','CC'), A, Y2('200','CC'),C
20, Y2('300','CC'),B, ,D
30, Y2('400','CC'), Y2('500','CC'),F,G
...
That is to change any item like X1'100' to Y2('100','CC') with sed or awk,
Please, can any gurus shed some light on it?
Thanks in advance.
ASKER CERTIFIED SOLUTION
Avatar of ozo
ozo
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jl66

ASKER

--ozo, Excellent!!!

One small thing:

In one of our servers,  the command generated several extra characters below. I tried the different way to run it, but they stayed there. It seems normal to run the other commands on this server. Do you know what caused them?
 
10, Y2('100','CC'), A, Y2('200','CC'),C
20, Y2('300','CC'),B, ,D
30, Y2('400','CC'), Y2('500','CC'),F,G

I tried to
Avatar of jl66

ASKER

run it on the other servers, it generated what I want. the shell on all servers are the same /bin/bash. Thanks.
Avatar of jl66

ASKER

As always, I greatly appreciated your constant help.