- 论坛徽章:
- 7
|
-i, --ignore-case
Ignore case distinctions in both the PATTERN and the input
files. (-i is specified by POSIX.)
我这有-i,但是貌似把整个正则表达式都忽略大小写了,所以变成了\w吧?
hcc-30:~/mytest/shell> cat bbb
aerrora
<Error>
[ERROR]
:ERROR:
hcc-30:~/mytest/shell> grep -Pi '\Werror\W' bbb
aerrora
herongguang@hcc-30:~/mytest/shell> grep --version
GNU grep 2.5.2
Copyright (C) 1988, 1992-2002, 2004, 2005 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
hcc-30:~/mytest/shell>
hcc-30:~/mytest/shell> grep -Pi '[^a-z]error[^a-z]' bbb<Error>
[ERROR]
:ERROR: |
|