

// first insert:

cat logDump.txt | sed -e 's/[^<]*<BR>//' | sed -e 's/<BR>.*//' | sed -e 's/last_words = \x27/last_words = \"/' | sed -E 's/(\"[^,]*)\x27,/\1\",/' > fixQuery.txt



// undo first insert

cat fixQuery.txt | sed -E 's/INSERT INTO/DELETE FROM/' | sed -E 's/SET/WHERE/' | sed -E 's/death_time[^,]*,//' | sed -E 's/, generation = .*//' | sed -E 's/, last_words = .*/;/' | sed -E 's/, / AND /g' > undoFixQuery.txt




// From mysql tabular result with time, log entry
select entry_time, entry from lineageServer_log where entry like "Fatal%";

// insert log time for CURRENT_TIMESTAMP

cat logDump2.txt | sed -E 's/\| ([0-9 :\-]*) \| (.*) CURRENT_TIMESTAMP(.*)/\2\"\1\"\3/' | sed -E 's/.*(Fatal.*line 1).*/\1/' > logDump2Time.txt




// now pass time-adjusted query through first sed filter

cat logDump2Time.txt | sed -e 's/[^<]*<BR>//' | sed -e 's/<BR>.*//' | sed -e 's/last_words = \x27/last_words = \"/' | sed -E 's/(\".*)\x27, generation = /\1\", generation = /' > fixQuery2.txt
