I have mysql dump file in the below format and I want to replace the 15th column value by matching given values with first two columns.
INSERT INTO TABLE VALUES
('20','ramesh',,,,,,,,,,,,,'1',,,),
('30','raghav',,,,,,,,,,,,,'1',,,),
('40','balaji',,,,,,,,,,,,,'1',,,);
Expected output:
INSERT INTO TABLE VALUES
('20','ramesh',,,,,,,,,,,,,'0',,,),
('30','raghav',,,,,,,,,,,,,'1',,,),
('40','balaji',,,,,,,,,,,,,'1',,,);
Here sed should match given empId and empName as '20' and 'ramesh' and replace 15th column of value '1' to '0'. In between columns 3,8 and 9 have json or xml string values
I tried with below sed capture group but it is not working.
sed -i -e "s|(\('20\)',\('ramesh'\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),\(.*\),'1'|(\1,\2,\3,\4,\5,\6,\7,\8,\9,\10,\11,\12,\13,\14,'0'|" employees.sql
Any help is appreciated.