【发布时间】:2014-05-30 17:40:17
【问题描述】:
我正在使用 awk 对包含特定关键字的段落进行 grep,直到记录分隔符在我的情况下是空格。
awk -vRS= /\<keyword2\>/ file.txt
file.txt 包含这个
this is the first keyword1 occurance
and line in the first paragraph
this is the second keyword2 occurance
and line in the second paragraph
现在awk 命令的输出应该是
this is the second keyword2 occurance
and line in the second paragraph
但它只适用于我的一个系统。对其他人不起作用。请帮忙
发现错误
在 Ubuntu 14.04 上安装了 nawk 并且不起作用。
与gawk 一起工作正常
【问题讨论】:
-
什么意思是不能在其他系统中工作?哪个系统是你的,哪个是其他的?
-
在一些 ubuntu 系统上
-
我猜这是由于我想要的一些精确的单词匹配行为
-
好像有帖子说加单引号没用。