Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
LABEL=/ / ext3 defaults 1 1<br />
If this option is not used, all the lines from the file system table will be displayed.<br />
4.2.2.2. Character classes<br />
A bracket expression is a list of characters enclosed by "[" and "]". It matches any single character in that list;<br />
if the first character of the list is the caret, "^", then it matches any character NOT in the list. For example, the<br />
regular expression "[0123456789]" matches any single digit.<br />
Within a bracket expression, a range expression consists of two characters separated by a hyphen. It matches<br />
any single character that sorts between the two characters, inclusive, using the locale's collating sequence and<br />
character set. For example, in the default C locale, "[a-d]" is equivalent to "[abcd]". Many locales sort<br />
characters in dictionary order, and in these locales "[a-d]" is typically not equivalent to "[abcd]"; it might be<br />
equivalent to "[aBbCcDd]", for example. To obtain the traditional interpretation of bracket expressions, you<br />
can use the C locale by setting the LC_ALL environment variable to the value "C".<br />
Finally, certain named classes of characters are predefined within bracket expressions. See the grep man or<br />
info pages for more information about these predefined expressions.<br />
cathy ~> grep [yf] /etc/group<br />
sys:x:3:root,bin,adm<br />
tty:x:5:<br />
mail:x:12:mail,postfix<br />
ftp:x:50:<br />
nobody:x:99:<br />
floppy:x:19:<br />
xfs:x:43:<br />
nfsnobody:x:65534:<br />
postfix:x:89:<br />
In the example, all the lines containing either a "y" or "f" character are displayed.<br />
4.2.2.3. Wildcards<br />
<strong>Bash</strong> <strong>Guide</strong> for <strong>Beginners</strong><br />
Use the "." for a single character match. If you want to get a list of all five-character English dictionary words<br />
starting with "c" and ending in "h" (handy for solving crosswords):<br />
cathy ~> grep '\' /usr/share/dict/words<br />
catch<br />
clash<br />
cloth<br />
coach<br />
couch<br />
cough<br />
crash<br />
crush<br />
If you want to display lines containing the literal dot character, use the -F option to grep.<br />
For matching multiple characters, use the asterisk. This example selects all words starting with "c" and ending<br />
in "h" from the system's dictionary:<br />
cathy ~> grep '\' /usr/share/dict/words<br />
caliph<br />
cash<br />
catch<br />
Chapter 4. Regular expressions 59