#!/bin/sed -nrf # remove the day s/.*day, // # convert month name to digit (im sure theres a cleaner way) s/January/01,/ s/February/02,/ s/March/03,/ s/April/04,/ s/May/05,/ s/June/06,/ s/July/07,/ s/August/08,/ s/September/09,/ s/October/10,/ s/November/11,/ s/December/12,/ # remove quotes and the first 10 lines (headers) 1,10d s/\"// # clean up the dates (the day will stay as 1/2 digits but mysql will clean it) s/([0-9]{1,2}), ([0-9]{1,2}), ([0-9]{4}),(.+)/\3-\1-\2 00:00:00,\4/ # now just print the lines starting with a number (drops the extra info at the bottom /^[0-9]/p