我想从日志中找到该文件的名称。我使用awk
命令尝试了它,但无法成功。
我试过了:
FILE=`grep "^.java" /home/jimit/TestLogs.log | awk '{print $2}' | awk -F ':' '{print $1}'`
echo $FILE
示例日志:CommentService
Caused by: com.ofss.fc.framework.exception.BusinessException: The memo start date cannot be earlier than the process date.
at com.ofss.fc.domain.party.service.core.CommentService.validateMemos(CommentService.java:474)
at com.ofss.fc.domain.party.service.core.CommentService.addMemosToParty(CommentService.java:655)
答案 0 :(得分:1)
试试这个
$ grep -o "[^.(]*\.java" log
CommentService.java
CommentService.java