grep command in depth

Advance usage of GREP command

What is GREP ?

The grep filter searches a file for a particular pattern of characters, and displays all lines that contain that pattern. GREP stands for  Global regular expression print .

GREP help menu

To see the help menu of GREP you have to use this command -:

grep --help 
grep help menu

GREP syntax

So, this is the basic syntax of grep. Firstly grep then followed by an option then pattern of the file or text to match then the file name.

grep [OPTION...]  PATTERNS  [FILE...]

grep [OPTION...]  -e PATTERNS...  [FILE...]

grep [OPTION...] -f  PATTERN_FILE ...  [FILE...]

GREP OPTIONS

grep options

Wildcards

wildcards

Regular expressions

regular expressions

BRE, ERE & PCRE PCRE

BRE, ERE & PCRE

Quantifiers

Posix

Posix

Position

Position
Spread the love

Leave a Comment

Your email address will not be published.