我想first 5 lines after the match found在vi编辑器中看到 .命令是什么?
我只知道这些命令
/Incident Id: 从头到尾提供所有行
:g/Incident ID: 只给出隐藏所有不匹配的匹配词
但是如何在找到匹配词之后显示前5行...?
预期输出的示例:
我有8行文字,我搜索事件ID
Incident ID: 1392875740716 <<<Match word here
URL: /Project/jsps/ErrorPage.jsp
java.lang.NullPointerException
at java.util.Calendar.setTime(Calendar.java:1092)
at com.cando.restaurant.utils.DateRange.createForWeek(DateRange.java:54)
at org.springframework.transaction.interceptor.TransactionInterceptor :110)
at org.springframework.aop.framework.ReflectiveMethodInvocation
at org.springframework.aop.interceptor.ExposeInvocationInterceptor
Run Code Online (Sandbox Code Playgroud)
预期产出
Incident ID: 1392875740716 <<<Match word here
URL: /Project/jsps/ErrorPage.jsp
java.lang.NullPointerException
at java.util.Calendar.setTime(Calendar.java:1092)
at com.cando.restaurant.utils.DateRange.createForWeek(DateRange.java:54)
Run Code Online (Sandbox Code Playgroud)
试试这个
:g/Incident ID/#5
Run Code Online (Sandbox Code Playgroud)
另见:help :g,:help :p和:help :z(如果你有vim,不是vi).