unix - How do i change the following input line using SED? -


how change following input line using sed ?

input - bus_ln in ('abc');

required o/p - bus_ln in ('def','xyz');

give try:

sed "s/\([^(]*\)('[^']*')/\1('def','xyz')/" inputfile 

it replace whatever between parentheses.

input:

bus_ln in ('abc'); foo('bar'); baz aaa bbb ('ccc ddd') more text 

output:

bus_ln in ('def','xyz'); foo('def','xyz'); baz aaa bbb ('def','xyz') more text 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -