bash grep 换行 [英] bash grep newline
本文介绍了bash grep 换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
[社论插入:同一张海报的前面的问题?]
我需要从文件中提取:
first
second
third
使用grep命令,如下一行:
using the grep command, the following line:
second
third
grep 命令应该是什么样子的?
How should the grep command look like?
推荐答案
代替grep
,你可以使用支持多行模式的pcregrep
Instead of grep
, you can use pcregrep
which supports multiline patterns
pcregrep -M 'second
third' file
-M
允许模式匹配多于一行.
-M
allows the pattern to match more than one line.
这篇关于bash grep 换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文