pmverma
pmverma

Reputation: 1703

How to correctly use the "grep" command

I am new to linux and commands. Basically I understand "grep" command.

But I do not understand what to do with following command, what it do, how to type command correctly.

grep -R -e

Examples to use correctly are welcome.

Upvotes: 1

Views: 776

Answers (1)

jeremyjjbrown
jeremyjjbrown

Reputation: 8009

Calling grep with those flags mean search recursively in the specified directory and all it's children for lines that match a regex.

grep -R -e /p.t/ .

Should find all lines with a p and t that has any single character in between that are in the current directory or any of it's children.

-e PATTERN, --regexp=PATTERN Use PATTERN as the pattern; useful to protect patterns beginning with -.

-R, -r, --recursive Read all files under each directory, recursively; this is equiv- alent to the -d recurse option.

http://unixhelp.ed.ac.uk/CGI/man-cgi?grep

Upvotes: 1

Related Questions