728x90 AdSpace

Wednesday, 6 September 2017

egrep Linux Command


egrep [options] [regexp] [files]
Search one or more files for lines that match an extended regular expression regexp. egrep doesn't support the regular expressions \(, \), \n, \<, \>, \{, or \}, but it does support the other expressions, as well as the extended set +, ?, |, and ( ). Remember to enclose these characters in quotes. Regular expressions are described in Chapter 7. Exit status is 0 if any lines match, 1 if none match, and 2 for errors.

See grep for the list of available options. Also see fgrep.


Search for occurrences of Victor or Victoria in file:
egrep 'Victor(ia)*' file egrep '(Victor|Victoria)' file
Find and print strings such as old.doc1 or new.doc2 in files, and include their line numbers:
egrep -n '(old|new)\.doc?' files
Annamalai Thangaraj

Annamalai is working as Technical Lead in Leading Telecom company with 5+ years experience in Identity and Access Management , Telecom and Networks, BigData, Java, Spring, Struts, Hibernate, AngularJS, and Enterprise Web Application Development.

Website: Java Tutorials Corner

Shop and help us

Flipkart Offer Snapdeal offer Amazon.in offer Amazon.com offer
  • Blogger Comments
  • Facebook Comments
  • Disqus Comments


Post a Comment

Item Reviewed: egrep Linux Command Rating: 5 Reviewed By: Annamalai Thangaraj