Linux egrep Command | Tutorial
Tutorial -- Learning is not just about technology, but also about dreams!
- Home
- HTML
- JavaScript
- CSS
- Vue
- React
- Python3
- Java
- C
- C++
- C#
- AI
- Go
- SQL
- Linux
- VS Code
- Bootstrap
- Git
- Local Bookmarks
Linux Tutorial
Linux Tutorial Linux Introduction Linux Installation Linux Cloud Server WSL Install Linux Linux System Boot Process Linux System Directory Structure Linux Forgot Password Solution Linux Remote Login Linux File Basic Attributes Linux File and Directory Management Linux User and User Group Management Linux Disk Management Linux vi/vim Linux yum command Linux apt command
Shell Tutorial
Shell Tutorial Shell Variables Shell Passing Arguments Shell Arrays Shell Operators Shell echo command Shell printf command Shell test command Shell Flow Control Shell Functions Shell Input/Output Redirection Shell File Inclusion
Linux Reference Manual
Linux Command Manual Nginx Installation and Configuration MySQL Installation and Configuration Linux Quiz
Nginx Installation and Configuration
Deep Dive
Computer Science
Programming Languages
Web Design and Development
Programming
Development Tools
Scripting
Web Services
Software
Web Service
Scripting Language
Linux egrep Command
The Linux egrep command is used to search for a specified string within a file.
The effect of egrep is similar to "grep -E". The syntax and parameters used can refer to the grep command. The difference from grep lies in the method of interpreting strings.
egrep interprets using extended regular expression syntax, while grep uses basic regular expression syntax. Extended regular expressions are more standardized in expression than basic regular expressions.
Syntax
egrep
Parameter Description:
- : The string rule to search for.
- : The target file or directory to search.
Example
Display characters in a file that meet the criteria. For example, to find all files in the current directory containing the string "Linux", you can use the following command:
egrep Linux *
The result is as follows:
$ egrep Linux * #Search in the current directory for files containing the stringβLinuxβof the file
testfile:hello Linux! #The following five lines are from testfile containing the character 'Linux'
testfile:Linux is a free Unix-type operating system.
testfile:This is a Linux testfile!
testfile:Linux
testfile:Linux
testfile1:helLinux! #The following two lines are from testfile1 containing the character 'Linux'
testfile1:This a Linux testfile!
#The following two lines are from testfile_2 containing the character 'Linux'
testfile_2:Linux is a free unix-type opterating system.
testfile_2:Linux test
xx00:hello Linux! #xx00Lines containing the character 'Linux'
xx01:Linux is a free Unix-type operating system.
#The following three lines are from xx01 containing the character 'Linux'
xx01:This is a Linux testfile!
xx01:Linux
YouTip