Grep unique Java exceptions stacktraces from input stream