103.7 Search Text Files With Regular Expressions Flashcards
Regular Expressions: grep
utility to find strings and phrases in
files
streams
directories
grep
Regular Expressions: grep
count matches found only
grep -c
Regular Expressions: grep
encloses the string match with # of lines of context before and after data
grep -C [#]
Regular Expressions: grep
use the indicated extended regular expression for finding match
grep -E [ext. regex]
Regular Expressions: grep
use the indicated fixed regular expression for finding a match
grep -F [fixed regex]
Regular Expressions: grep
displays the filename of each matching string or phrase
grep -H
Regular Expressions: grep
prevents the filename from being displayed
grep -h
Regular Expressions: grep
ignore case
grep -i
Regular Expressions: grep
show only the filename and not the matched string/phrase
grep -l
Regular Expressions: grep
show only filenames that do NOT contain a match
grep -L
Regular Expressions: grep
match only lines containing the whole string or phrase
grep -w
Regular Expressions: grep
show only exact whole line matches to the entire string or phrase
grep -x
Regular Expressions: grep
show only those lines in a file that do NOT match the string or phrase (opposite of default)
grep -v
Regular Expressions: egrep
grep command without having to specify the -E that allows use of extended regular expression to match patterns of text
egrep
Regular Expressions: egrep
would display any entry in /etc/passwd file that starts with ope and then has either n or r as the next letter
egrep ^ope(n|r) /etc/passwd