[英]why egrep doesn't work correctly on AIX?
I have a simple egrep for searching C/C++ main files(by searching for the main function): 我有一个简单的egrep用于搜索C / C ++主文件(通过搜索main函数):
egrep '^\s*(int|void)\s+main' *.c*
I also have 2 machines one Linux one Aix. 我也有两台机器,一台Linux,一台Aix。 On the Linux, this command runs perfectly fine.
在Linux上,此命令运行良好。 On the Aix it doesn't - it doesn't return results.Even more, on the Aix the following command does return results:
在Aix上它不会-不返回结果。甚至,在Aix上,以下命令也可以返回结果:
egrep '^\s*(int|void)\s+' *.c*
What is the reason for this? 这是什么原因呢?
The non-GNU egrep
supplied in AIX apparently doesn't support the '\\s' escape sequence, at least according to my test. 至少根据我的测试,AIX中提供的非GNU
egrep
显然不支持'\\ s'转义序列。
Try with the following: 请尝试以下操作:
egrep '^[ \t]*(int|void)[ \t]+main' *.c*
which seems to work for me for the AIX pgrep. 这对于AIX pgrep似乎很适合我。
(but still wondering then how egrep '^\\s*(int|void)\\s+' *.c*
could work for you as it doesn't seem to work for me) (但仍然想知道
egrep '^\\s*(int|void)\\s+' *.c*
为您工作,因为它似乎不适用于我)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.