Global search for a Regular Expression and Print
| Description | Command |
| Match count | -c |
| case insensitive search | -i |
| recursive search | -r |
| select non-matching lines | -v |
| show matched text in color | --color |
| show matched text and next n lines after it | -A n (eg: grep -A 3 "example" demo.txt |
| show file name along with matched line | -H |
| exclude hidden directories in search results | --exclude="\.*" (eg: grep -iHr --exclude="\.*" "text" * |
| show line numbers | -n |
| search in only specific file types | *.fileType (eg: grep -n "print" *.java) |
No comments:
Post a Comment