egrep is actually same as grep -E, it interpret PATTERN as an extended regular expression. Therefore ESCAPE ( \ ) is not needed for certain symbol.
ls is a common tool for listing file that matches the keyword.
Regular expression (RE) is a very important and useful to manipulating strings and text. In this example, I would like to introduce few RE symbols.
Asterisk ( * ) – This matches any number (including ZERO) of repeats of the character string.
This will return files with filename: file123, file1234, file 1223444.
Dot ( . ) – This will matches any one character, but except newline.
This will return files with filename: file1234q, file12345, but not file1234
Caret ( ^ ) – This indicate begin of line, but sometimes it indicate negative too.
Dollar Sign ( $ ) – This indicate end of line, but sometimes it indicate value of variable too.
If you want to grep “void” at the begin of lines, you do this:
egrep "^void" myhello.c
If you want to grep “)” at the end of lines, you do this:
egrep "\)" myhello.c
You need to put escape because “)” is a special symbol.
To filter out the blank lines, you do this:
grep -v "^$" mysetting.conf