grep command in depth

Mastering GREP Command in Linux: A Beginner’s Guide

Table Of Contents :

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

IMG 20220710 152346 768x496 1

Posix

Posix

Position

Position
Spread the love
Scroll to Top
www.thecyberblogs.com