我想使用grep在匹配后显示行内容

时间:2012-08-07 14:24:39

标签: unix

我在下面的日志文件中有内容:

Aug 02 22:01:18.0937 CDT Thread-4-610399 java.lang.IllegalStateException: perfdb_connectstring was not found in the supplied property file(s).

我希望使用grep命令在提供的属性文件中输出为java.lang.IllegalStateException: perfdb_connectstring was not found

请尽快回复。

1 个答案:

答案 0 :(得分:0)

你真的需要使用'grep'吗?如果日志文件始终具有此格式,则可以使用“cut”

cut -d" " -f6- file.log

它会输出你想要的stdout:

java.lang.IllegalStateException: perfdb_connectstring was not found in the supplied property file(s).