3.2 Searching and Extracting Data from Files Flashcards
Search Extract
append
> >
Search Extract
redirect
>
Search Extract
grep
search in case insensitive
grep -i
Search Extract
grep
search is recursive - it searches into all files within the given directory and its subdirs
grep -r
Search Extract
grep
the search counts the number of matches
grep -c
Search Extract
grep
inverts the match to print lines that do not match the search term
grep -v
Search Extract
grep
turns on extended regular expressions (needed by some of the more advanced meta-characters
like | , + and ?)
grep -E
Search Extract
regular expression
matches any single character (except newline)
.
Search Extract
regular expression
match any one character within brackets
[abcABC]
Search Extract
regular expression
match any one character except the ones in brackets
[^abcABC]
Search Extract
regular expression
match any character in the range
[a-z]
Search Extract
regular expression
match any one character except the ones in range
[^a-z]
Search Extract
regular expression
start of line
Search Extract
regular expression
End of line
$
Search Extract
regular expression meta characters
zero or more of the preceeding pattern
*
Search Extract
regular expression meta characters
one or more of the preceeding pattern
+
Search Extract
regular expression meta characters
zero or one of the preceeding pattern
?
Search Extract
regular expression
includes: pot, spot, apot
excludes: potic, spots, potatoe
pot$
Search Extract
regular expression
Include: arp99, apple, zipper
Exclude: zoo, arrive, attack
p+
Search Extract
regular expression
Include: arcane, capper, zoology
Exclude: air, coper, zoloc
arc|cap|zoo
Search Extract
regular expression
Include: 0th/pt, 3th/tc, 9th/pt
Exclude: 0/nm, 3/nm, 9/nm
[0-9]th.+
Search Extract
regular expression
Include: Hawaii, Dario, Ramiro
Exclude: hawaii, Ian, Alice
^[A-Z]a.*i+
Search Extract
command can find and replace characters or sets of characters within
a file.
sed