sed找到了带有集合项目的行(a、an、the)
我应该找到我自己写的文章。在前10行中搜索sed找到了带有集合项目的行(a、an、the),sed,Sed,我应该找到我自己写的文章。在前10行中搜索 sed -n '/the/p' file.txt | sed -n '/ a /p' file.txt 将仅显示最后一个命令的输出。也 sed -n '1,10 /the/p' file 或 不起作用,我发现范围的用法只适用于以下模式 [range]/s/pattern/pattern/p 如何组合多个条件和行的范围 文件示例: For the first time since early February the top three film
sed -n '/the/p' file.txt | sed -n '/ a /p' file.txt
将仅显示最后一个命令的输出。也
sed -n '1,10 /the/p' file
或
不起作用,我发现范围的用法只适用于以下模式
[range]/s/pattern/pattern/p
如何组合多个条件和行的范围
文件示例:
For the first time since early February
the top three films at the weekend
box office were all new releases
and leading the way was
Fox's Bohemian Rhapsody
with a $50 million
chart-topping performance
well above expectations.
That said, the weekend isn't all about
new releases as the holdovers
输出应为:
For the first time since early February
the top three films at the weekend
and leading the way was
with a $50 million
That said, the weekend isn't all about
new releases as the holdovers
- 获取包含
sed -n '1,10{/\<the\>/p}' file
a
不一定只查找文章a
。
sed -n '1,10{/\<the\>/p}' file
sed -n '1,10{/\<\(the\|a\|an\)\>/p}' file