![]() ![]() Again, grep requires that you precede the pipe character with a backslash - but with egrep you can simply include it in your commands. The “pipe” character lets you separate a pair of characters, and will match if a line contains either character. ![]() You can also do the same quantity-matching with grep, but you have to precede the characters with a backslash.Īnd there’s one more powerful way to soup up your pattern matching: alternation. That lets you get more specific about how many times you want a character to appear in your matches. It’s like grep with a superpower - it searches through every subdirectory.Īnd then there’s egrep , which is the same as grep -E, though the grep man page warns that egrep “is deprecated,” but “is provided to allow historical applications that rely on them to run unmodified.” Searches with egrep match not only the usual metacharacters ( .* ^ $) but also the Posix-defined set of (E)xtended regular expressions. For example, there’s the recursive rgrep, which is the same as grep -r. History has it that Ken Thompson coded up the grep tool overnight to help a colleague search through the entire text of the Federalist Papers without having to load the whole thing into memory first.īut in the same way that the ed command g/ re/p became a stand-alone tool named “grep,” some of grep’s most useful flags eventually spun off into more tools. ![]() Yes, it was such a useful command that eventually became its own stand-alone tool. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |