|
UNIX Shells by Example Authors: Quigley E. Published year: 2004 Pages: 35-37/454 |
| < Day Day Up > |
4.10. Fixed grep ( grep “F and fgrep )The fgrep command behaves like grep , but does not recognize any regular expression metacharacters as being special. All characters represent only themselves . A caret is simply a caret, a dollar sign is a dollar sign, and so forth. With the “F option, GNU grep behaves exactly the same as fgrep . Example 4.51.% fgrep '[A-Z]****[0-9]...00' file or % grep -F '[A-Z]****[0-9]...00' file EXPLANATION Finds all lines in the file containing the literal string [A “Z]****[0 “9]...00 . All characters are treated as themselves. There are no special characters. |
| < Day Day Up > |
| < Day Day Up > |
4.11. Recursive grep ( rgrep , grep “R )Unlike the members of the grep family, Linux's rgrep can recursively descend a directory tree. Rgrep has a number of command-line options and supports the same metacharacters as regular grep ( grep “R ). See Appendix A for a complete description of rgrep , or type rgrep “? for online help (not supported on regular versions of UNIX). Example 4.52.% grep -r 'Tom' ./dir % rgrep 'Tom' ./dir EXPLANATION Searches recursively for all files containing Tom starting from under the ./dir directory. |
| < Day Day Up > |
| < Day Day Up > |
4.12. GNU grep with OptionsThe grep command has a number of options that control its behavior. The GNU version of grep added a number of new options and alternative ways to use the options. The GNU grep options work with all the different variants of grep , including grep “G , “E , and “F , as shown in Table 4.11. Table 4.11. GNU grep Options for All Variants (-G , -E , and -F )
|
| < Day Day Up > |
|
UNIX Shells by Example Authors: Quigley E. Published year: 2004 Pages: 35-37/454 |
![]() UNIX and Linux System Administration Handbook (4th Edition) | ![]() Perl by Example (4th Edition) | ![]() Learning the bash Shell: Unix Shell Programming (In a Nutshell (O'Reilly)) | ![]() Unix Shell Programming (3rd Edition) |
![]() UNIX and Linux System Administration Handbook (4th Edition) | ![]() Perl by Example (4th Edition) |
![]() Learning the bash Shell: Unix Shell Programming (In a Nutshell (O'Reilly)) | ![]() Unix Shell Programming (3rd Edition) |