jl66
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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
run it on the other servers, it generated what I want. the shell on all servers are the same /bin/bash. Thanks.
ASKER
As always, I greatly appreciated your constant help.
ASKER
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