我试图使用grep命令从日志文件中获取日志.但是,我可以匹配时间戳,但是没有得到我需要的完整堆栈跟踪.
[1/10/16 23:55:33:018 PST] 00000057 ServerObj E SECJ0373E: Exception message
at com.own.ws.wim.util.UniqueNameHelper.formatUniqueName(UniqueNameHelper.java:102)
at com.own.ws.wim.ProfileManager.getImpl(ProfileManager.java:1569)
Run Code Online (Sandbox Code Playgroud)
我能够获取日志条目,但我也想要堆栈跟踪.我试过了:
$ grep -i '^[[:space:]]*at' --before-context=2 SystemOut.log |
grep "1/13/16 7:[1-60]"
[1/10/16 23:55:33:018 PST] 00000057 ServerObj E SECJ0373E: Exception message
Run Code Online (Sandbox Code Playgroud)
知道如何实现这一目标吗?