LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-24-2018, 05:14 AM   #1
winn
LQ Newbie
 
Registered: Jan 2018
Posts: 2

Rep: Reputation: Disabled
What is the difference between grep and egrep command


Hi I am new to Linux, can someone advise what is the difference between grep and egrep command.
 
Old 01-24-2018, 05:17 AM   #2
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,103

Rep: Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117Reputation: 4117
The help for linux commands is the "man page" system.
"man grep" from a terminal will help. Use "q" (no quotes) to quit.
 
Old 01-24-2018, 05:24 AM   #3
winn
LQ Newbie
 
Registered: Jan 2018
Posts: 2

Original Poster
Rep: Reputation: Disabled
Thanks a lot. Will do some research on that.
 
Old 01-24-2018, 06:30 AM   #4
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
I can imagine the man pages are a bit overwhelming and do do really tell how to use grep. Grep and egrep is all about finding regular expressions.

Grep and egrep differ in how they handle regular expressions. Grep handles normal regular expressions, egrep handles extended regular expression syntax. Those are similar, but not identical. Extended regular expressions is a new definition which is not upward compatible with normal regular expressions. There is at least one case I know where a sequence in extended regular expression is the opposite of the same sequence in normal regular expression.

Differences between the two are pointed out here: https://www.regular-expressions.info/posix.html For more information on how to use grep, google for "regular expressions", not for grep.

grep -E is identical to egrep, it make grep to use extended regular expressions.

jlinkels
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
grep or egrep totemtommie Linux - Newbie 7 07-24-2014 06:41 AM
[SOLVED] grep or egrep help roopakl Linux - Newbie 3 12-19-2012 11:12 AM
[SOLVED] Difference between grep and find command gardenair Linux - Newbie 2 12-24-2010 04:16 AM
Help with ls and grep/egrep kasthana Linux - Newbie 1 05-29-2008 01:06 PM
Using Grep and Egrep linux-nerd Linux - General 5 10-10-2004 11:37 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration