Home > OS >  Grep is unreliable, with an exact match can also match to other lines
Grep is unreliable, with an exact match can also match to other lines

Time:09-16

As title, I am the true, or the usage of the bosses help me to correct it is my fault?

CodePudding user response:

The grep honestly not deceives you
reference
- w, - word - regexp
Select only those lines containing matches that form The whole words. The test is that The matching substring must either
Be at the beginning of the line, or preceded by a non - word constituent character. Similarly, it must be either at the
The end of the line or followed by a non - word constituent character. The word - constituent characters are letters, who, and
The the underscore.

Dash does not divide the word, so can normal matching,

Pure grep is not easy to achieve your requirements, with the help of a perl
 grep -p '\ bTEXT (? ! [/w]) '/path/to/your/file 

CodePudding user response:

Under the simple good, can say you give the meaning of this perl grep, I read a \ w and arbitrary - and then take the,

CodePudding user response:

reference 1st floor alittlenewbiek response:
grep honestly not deceives you
reference
- w, - word - regexp
Select only those lines containing matches that form The whole words. The test is that The matching substring must either
Be at the beginning of the line, or preceded by a non - word constituent character. Similarly, it must be either at the
The end of the line or followed by a non - word constituent character. The word - constituent characters are letters, who, and
The the underscore.

Dash does not divide the word, so can normal matching,

Pure grep is not easy to achieve your requirements, with the help of a perl
 grep -p '\ bTEXT (? ! [/w]) '/path/to/your/file 

Under the simple good, can say you give the meaning of this perl grep, I read a \ w and arbitrary - and then take the,

CodePudding user response:

reference weixin_45621200 reply: 3/f
Quote: refer to 1st floor alittlenewbiek response:
grep honestly not deceives you
reference
- w, - word - regexp
Select only those lines containing matches that form The whole words. The test is that The matching substring must either
Be at the beginning of the line, or preceded by a non - word constituent character. Similarly, it must be either at the
The end of the line or followed by a non - word constituent character. The word - constituent characters are letters, who, and
The the underscore.

Dash does not divide the word, so can normal matching,

Pure grep is not easy to achieve your requirements, with the help of a perl
 grep -p '\ bTEXT (? ! [/w]) '/path/to/your/file 

Under the simple good, can say you give the meaning of this perl grep, I read a \ w and arbitrary - and then take the

(ABC? ! The PATTERN) is a syntax, you can search negative lookahead,
Said that the current character of ABC while matching, but if the PATTERN on the back of character can fit to ABC is not matching,
  • Related