最佳答案
                                        
                                                                        
                                我想要一种在给定文本中搜索的方法。为此,我使用grep:
grep -i "my_regex"
这工作。但考虑到这样的数据:
This is the test data
This is the error data as follows
. . .
. . . .
. . . . . .
. . . . . . . . .
Error data ends
一旦我找到了单词error(使用grep -i error data),我希望找到单词error后面的10行。所以我的输出应该是:
. . .
. . . .
. . . . . .
. . . . . . . . .
Error data ends
有什么办法可以做到吗?
 
                                
                             
                                
                             
                                
                            