You're replying to a comment by Anirudh.

Anirudh Permalink
January 31, 2016, 13:17

#n

#
# sed registers:
# ...P.S. => pattern space
# ...H.S. => hold space
#

#
# timestamp entry:
# ...[mm/dd/yy HRS:MIN:SEC:MSEC TZ]
#
# ......mm: 1 .. 12 = [1-9]\|[1][0-2]
# ......dd: 1 .. 31 = [1-9]\|[1-2][0-9]\|[3][0-1]
# ......yy: 00 .. 99 = [0-9]\{2\}
#
# ......HRS: 0 .. 23 = [0-9]\|[1][0-9]\|[2][0-3]
# ......MIN: 00 .. 59 = [0-5][0-9]
# ......SEC: 00 .. 59 = [0-5][0-9]
# ......MSEC: 000 .. 999 = [0-9]\{3\}
#
# ......TZ: [ECMP]ST
#

/\n/bchop

/^\[\([1-9]\|[1][0-2]\)\/\([1-9]\|[1-2][0-9]\|[3][0-1]\)\/[0-9]\{2\}\s\+\([0-9]\|[1][0-9]\|[2][0-3]\):\([0-5][0-9]\):\([0-5][0-9]\):[0-9]\{3\}\s\+[ECMP]ST\]/!d

:loop
$d; H;1h; n
//!bloop

x

# status of the sed registers at this point:
# P.S. => current timepoint \n junk lines \n stack trace
# H.S. => next timepoint

# nota stack trace
/org[.]hibernate[.]SessionException[:]/!{
g;s/^/\n/;D
}

# stack trace
G;h; # H.S. => current timepoint \n junk lines \n stack trace \n next timepoint
s/\n.*//; # P.S. => current timepoint

/org[.]hibernate[.]SessionException[:]/{
# timepoint + exception together
g; s/^\(.*\)\n.*/\1/p; # strip the next timepoint & print current timepoint alongwith stacktrace
g; s/.*\(\n\)/\1/;D; # start over with the next timepoint
}

# timepoint + exception NOT on same line
g; s/^\(.*\)\n.*/\1/; P

# keep chopping the lines in P.S.
# until we hit the session exception
# line at the beginning of P.S.

:chop
/^org[.]hibernate[.]SessionException[:]/!D
p
g; s/.*\(\n\)/\1/;D; # start over with the next timepoint

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "antispam_95": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.