Perintah untuk mencari kata kunci dalam file

grep <search keyword> <filename>

# -n flag displays the line numbers the keyword appear on
grep -n <search keyword> <filename>

# -C flag print a given number of lines before and after the occurrence of the search keyword
# to give more context to the search result
grep -nC <integer for lines to print before and after> <search keyword> <filename>

# -r flag asks grep to search recusively in all files and directories
grep -r "search keyword" <location e.g ~ . /Documents>

# -i to ignore case sensitive search
grep -i "Keyword" <Location to search>

# -E is used to match a regex(regular expression) pattern.
# e.g for an email address,
grep -rE -o grep -rE -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b" ~
Chris Nzoka-okoye