grep
이 일치하는 다수의 "모드"가, 기본적으로 단지 기본 세트를 사용하는 탈출하지 않는 한 많은 수의 메타 문자를 인식하지 못합니다. 확장 또는 펄 모드에 grep을 넣어서 +
을 평가할 수 있습니다. man grep
에서
:
Matcher Selection
-E, --extended-regexp
Interpret PATTERN as an extended regular expression (ERE, see below). (-E is specified by POSIX.)
-P, --perl-regexp
Interpret PATTERN as a Perl regular expression. This is highly experimental and grep -P may warn of unimplemented features.
Basic vs Extended Regular Expressions
In basic regular expressions the meta-characters ?, +, {, |, (, and) lose their special meaning; instead use the backslashed versions \?, \+, \{, \|, \(, and \).
Traditional egrep did not support the { meta-character, and some egrep implementations support \{ instead, so portable scripts should avoid { in grep -E patterns and should use [{] to match a literal {.
GNU grep -E attempts to support traditional usage by assuming that { is not special if it would be the start of an invalid interval specification. For example, the command grep -E '{1' searches for the two-character string {1 instead of reporting a syntax
error in the regular expression. POSIX.2 allows this behavior as an extension, but portable scripts should avoid it.
다른 방법으로, 당신은 egrep
대신 grep -E
사용할 수 있습니다.
당신이'의미 그렙 -E' –