Fixup grammar in grep cheatsheet

This commit is contained in:
Shadab Zafar 2015-06-19 23:16:06 +05:30
parent 402d15e8d8
commit 97dd037538

View file

@ -1,13 +1,13 @@
# Basic: # Search a file for a pattern
grep pattern file grep pattern file
# case nonsensitive research: # Case insensitive search (with line numbers)
grep -i pattern file grep -in pattern file
# Recursively grep for string <pattern> in folder: # Recursively grep for string <pattern> in folder:
grep -R pattern folder grep -R pattern folder
# Getting pattern from file (one by line): # Read search patterns from a file (one per line)
grep -f pattern_file file grep -f pattern_file file
# Find lines NOT containing pattern # Find lines NOT containing pattern
@ -17,7 +17,7 @@ grep -v pattern file
grep "^00" file #Match lines starting with 00 grep "^00" file #Match lines starting with 00
grep -E "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" file #Find IP add grep -E "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" file #Find IP add
# Find all files who contain {pattern} in the directory {directory}. # Find all files which match {pattern} in {directory}
# This will show: "file:line my research" # This will show: "file:line my research"
grep -rnw 'directory' -e "pattern" grep -rnw 'directory' -e "pattern"