Using regular expressions with the grep command

The following characters can be used to create regular expressions for searching on patterns with grep.

Always quote the regular expression. This prevents the shell from interpreting the special characters before it is passed to the grep command.

c       any non-special character represents itself
\\c     turns off the meaning of any special character
^       beginning of a line
$	end of a line
.       matches any single character except a newline
[...]   matches any of the enclosed characters
[^...]  matches any character that is not enclosed
[n-n]   matches any character in this range
*       matches any number of the preceding character

[Home] [Search] [Index] This site maintained by guichard@whitman.edu