Easy Tutorial
❮ Linux Comm Netstat Linux Comm Zip ❯

Linux egrep Command

Linux Command Manual

The Linux egrep command is used to search for specified strings within files.

egrep operates similarly to "grep -E" and uses the same syntax and parameters as the grep command. The difference lies in how the strings are interpreted.

egrep interprets strings using extended regular expression syntax, while grep uses basic regular expression syntax. Extended regular expressions are more standardized than basic regular expressions.

Syntax

egrep [pattern] [file or directory]

Parameter Description:

Example

Display characters that match the condition in the file. For example, to find files in the current directory that contain the string "Linux", you can use the following command:

egrep Linux *

The result is as follows:

$ egrep Linux * # Search for files in the current directory containing the string "Linux"
testfile:hello Linux! # The following five lines are from testfile containing the Linux character
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 Linux character
testfile1:This a Linux testfile!
# The following two lines are from testfile_2 containing the Linux character
testfile_2:Linux is a free unix-type opterating system.
testfile_2:Linux test
xx00:hello Linux! # The line from xx00 containing the Linux character
xx01:Linux is a free Unix-type operating system. # The following three lines are from xx01 containing the Linux character
xx01:This is a Linux testfile!
xx01:Linux

Linux Command Manual

❮ Linux Comm Netstat Linux Comm Zip ❯