I have a .sql file with some 15,000,000 INSERT commands on each line, which look something like this:
INSERT INTO tableName (col1,col2,col3,col4,col5,col6,col7,col8) VALUES ('Jan 7 2018 12:33PM', 'R', 'essential-app', '15952008002', 'Jan 7 2018 12:30PM', '0', 'E', NULL);
I want to wrap both date/time values so they look like STR_TO_DATE('Jan 7 2018 12:33PM',%b %d %Y %h:%i%p)
- preserving the original value, of course.
I have used sed to make small changes to files before, but never something as complicated as this. How do I go about targeting both those date/time values, and how do I go about adding strings to both the beginning and end of the matched strings?
Add to the beginning: STR_TO_DATE(
Add to the end: ,%b %d %Y %h:%i%p)
Can it be done in one sed command, or do I need a sed command for each date/time value?