I have a log file that looks like this:
11-Sep-2012 00:00:00 clojure.contrib.logging$fn__43$impl_write_BANG___51 invoke INFO: creditAcc(args=[1506112834429596390 7080851004 4500]) 11-Sep-2012 00:00:00 clojure.contrib.logging$fn__43$impl_write_BANG___51 invoke INFO: callProf|tupsCredit|180|[1506112834429596390 7080851004 45] 11-Sep-2012 00:00:00 clojure.contrib.logging$fn__43$impl_write_BANG___51 invoke INFO: creditAcc(args=[1506112834429596390 7080851004 4500]) -> done. 11-Sep-2012 00:00:00 clojure.contrib.logging$fn__43$impl_write_BANG___51 invoke INFO: return(1506112834429596390,0)
Each entry in the log file spans two lines, so each entry begins with a timestamp. I have managed to replace the linefeed character at the end of the first line using sed, but the problem is that somewhere in the middle of the log entries are java stacktrace messages. When sed gets through the stacktraces, it reverses the order of the entries and they begin with INFO or ERROR etc and the timestamp shows as the 2nd line. I was therefore looking for a solution that would force sed to recognize the timestamp as the first line using regex [something like ^\d{2}] , then in the same line, replace the linefeed character with a space then break the values into columns for analysis. The stacktrace messages begin with blank spaces [^\s], so they are easy to identify and skip.
What is the best way to go about solving this using sed or awk?