@Franklin52
When I run your command it places the single quotes around the dates but it removed the commas
...VALUES (1 182 '2004-...
I was able to get it with this
sed s/VALUES\ \([0-9]*\,[0-9]*\,/\&\'/ | sed s/..:..:../\&\'/
but then I realized that the timestamp also appears in other tables (different fields and more than once)
This is where I am right now
sed s/....-..-..\ ..:..:../\'&\'/g
The only problem with that is some timestamps already have single quotes around them and now after this line, some timestamps get 2 singles quotes surrounding them ''2004-08-06 09:24:04''
Is there anyway to do it so that it skips any timestamps that already have quotes?
I can do
s/,....-..-..\ ..:..:../\'&\'/g
but that would place the single quote ',2004-08-06 09:24:04' Is it possible to include the comma in the search and then place the single quote right after it?
Ok, so awk seems to be the way to go here. I've used it twice already in the sql file, but the 3rd time is a bit different. Same deal as before, I need to put single quotes around the date/time
So, change this
INSERT INTO logincookies VALUES (3229,47,'201.208.41.125',2008-03-12 17:42:49);
to
INSERT INTO logincookies VALUES (3229,47,'201.208.41.125','2008-03-12 17:42:49');
When I use this command
awk 'BEGIN{FS=OFS=","}/INSERT INTO logincookies VALUES/{$4="\047"$4"\047"}1' backup.sql
it puts the single quotes
INSERT INTO logincookies VALUES (3229,47,'201.208.41.125','2008-03-12 17:42:49);'