Time:09-16
CodePudding user response:
- 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.
grep -p '\ bTEXT (? ! [/w]) '/path/to/your/file
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
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
Page link:https//www.codepudding.com/os/1532.html