GenWikiLinux
From birchyHistory
Line 3: | Line 3: | ||
== GREP == | == GREP == | ||
− | grep [ | + | grep [OPTIONS] "foo" [FILES(s)] |
− | * | + | *Single or double quotes can be used. |
+ | *Quotes can be omitted if there are no spaces in the search term. | ||
*If file is omitted, all files in current dir are searched. | *If file is omitted, all files in current dir are searched. | ||
*Multiple files can be specified separated by spaces or wildcarded (*.txt) | *Multiple files can be specified separated by spaces or wildcarded (*.txt) | ||
− | * | + | *''While most tutorials assume that you are going to specify a file to search, using the search feature in vi makes more sense for working with a single file.'' |
+ | OPTIONS: | ||
-i ignore case | -i ignore case | ||
-n print line #s | -n print line #s | ||
Line 20: | Line 22: | ||
− | foo can be any [[Regular Expression]] | + | "foo" can be any [[Regular Expression]] |
− | + | ||
egrep supports pipes ("or") (= grep -E) | egrep supports pipes ("or") (= grep -E) |