+
+ Regex operator |
+ Meaning |
+
+
+ . |
+ Matches any single character. |
+
+
+ ? |
+ The preceding item is optional and will be matched, at most, once. |
+
+
+ * |
+ The preceding item will be matched zero or more times. |
+
+
+ + |
+ The preceding item will be matched one or more times. |
+
+
+ {N} |
+ The preceding item is matched exactly N times. |
+
+
+ {N,} |
+ The preceding item is matched N or more times. |
+
+
+ {N,M} |
+ The preceding item is matched at least N times, but not more than M times. |
+
+
+ - |
+ Represents the range if it's not first or last in a list or the ending point of a range in a list. |
+
+
+ ^ |
+ Matches the empty string at the beginning of a line; also represents the characters not in the range of a list. |
+
+
+ $ |
+ Matches the empty string at the end of a line. |
+
+
+ \b |
+ Matches the empty string at the edge of a word. |
+
+
+ \B |
+ Matches the empty string provided it's not at the edge of a word. |
+
+
+ \< |
+ Match the empty string at the beginning of word. |
+
+
+ \> |
+ Match the empty string at the end of word. |
+
+
+
+#### grep vs egrep ####
+
+egrep is the same as **grep -E**. It interpret PATTERN as an extended regular expression. From the grep man page:
+
+ In basic regular expressions the meta-characters ?, +, {, |, (, and ) lose their special meaning; instead use the backslashed versions \?, \+, \{,
+ \|, \(, and \).
+ Traditional egrep did not support the { meta-character, and some egrep implementations support \{ instead, so portable scripts should avoid { in
+ grep -E patterns and should use [{] to match a literal {.
+ GNU grep -E attempts to support traditional usage by assuming that { is not special if it would be the start of an invalid interval specification.
+ For example, the command grep -E '{1' searches for the two-character string {1 instead of reporting a syntax error in the regular expression.
+ POSIX.2 allows this behavior as an extension, but portable scripts should avoid it.
+
+References:
+
+- man page grep and regex(7)
+- info page grep`
+
+--------------------------------------------------------------------------------
+
+via: http://www.cyberciti.biz/faq/grep-regular-expressions/
+
+作者:Vivek Gite
+译者:[译者ID](https://github.com/译者ID)
+校对:[校对者ID](https://github.com/校对者ID)
+
+本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
\ No newline at end of file
diff --git a/sources/tech/Linux or UNIX grep Command Tutorial series/20151127 Linux or UNIX grep Command Tutorial series 3--Search Multiple Words or String Pattern Using grep Command.md b/sources/tech/Linux or UNIX grep Command Tutorial series/20151127 Linux or UNIX grep Command Tutorial series 3--Search Multiple Words or String Pattern Using grep Command.md
new file mode 100644
index 0000000000..bb12d2e1b3
--- /dev/null
+++ b/sources/tech/Linux or UNIX grep Command Tutorial series/20151127 Linux or UNIX grep Command Tutorial series 3--Search Multiple Words or String Pattern Using grep Command.md
@@ -0,0 +1,41 @@
+Search Multiple Words / String Pattern Using grep Command
+================================================================================
+How do I search multiple strings or words using the grep command? For example I'd like to search word1, word2, word3 and so on within /path/to/file. How do I force grep to search multiple words?
+
+The [grep command supports regular expression][1] pattern. To search multiple words, use following syntax:
+
+ grep 'word1\|word2\|word3' /path/to/file
+
+In this example, search warning, error, and critical words in a text log file called /var/log/messages, enter:
+
+ $ grep 'warning\|error\|critical' /var/log/messages
+
+To just match words, add -w swith:
+
+ $ grep -w 'warning\|error\|critical' /var/log/messages
+
+egrep command can skip the above syntax and use the following syntax:
+
+ $ egrep -w 'warning|error|critical' /var/log/messages
+
+I recommend that you pass the -i (ignore case) and --color option as follows:
+
+ $ egrep -wi --color 'warning|error|critical' /var/log/messages
+
+Sample outputs:
+
+
+
+Fig.01: Linux / Unix egrep Command Search Multiple Words Demo Output
+
+--------------------------------------------------------------------------------
+
+via: http://www.cyberciti.biz/faq/searching-multiple-words-string-using-grep/
+
+作者:Vivek Gite
+译者:[译者ID](https://github.com/译者ID)
+校对:[校对者ID](https://github.com/校对者ID)
+
+本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
+
+[1]:http://www.cyberciti.biz/faq/grep-regular-expressions/
\ No newline at end of file
diff --git a/sources/tech/Linux or UNIX grep Command Tutorial series/20151127 Linux or UNIX grep Command Tutorial series 4--Grep Count Lines If a String or Word Matches.md b/sources/tech/Linux or UNIX grep Command Tutorial series/20151127 Linux or UNIX grep Command Tutorial series 4--Grep Count Lines If a String or Word Matches.md
new file mode 100644
index 0000000000..cc11cf85c2
--- /dev/null
+++ b/sources/tech/Linux or UNIX grep Command Tutorial series/20151127 Linux or UNIX grep Command Tutorial series 4--Grep Count Lines If a String or Word Matches.md
@@ -0,0 +1,33 @@
+Grep Count Lines If a String / Word Matches
+================================================================================
+How do I count lines if given word or string matches for each input file under Linux or UNIX operating systems?
+
+You need to pass the -c or --count option to suppress normal output. It will display a count of matching lines for each input file:
+
+ $ grep -c vivek /etc/passwd
+
+OR
+
+ $ grep -w -c vivek /etc/passwd
+
+Sample outputs:
+
+ 1
+
+However, with the -v or --invert-match option it will count non-matching lines, enter:
+
+ $ grep -c vivek /etc/passwd
+
+Sample outputs:
+
+ 45
+
+--------------------------------------------------------------------------------
+
+via: http://www.cyberciti.biz/faq/grep-count-lines-if-a-string-word-matches/
+
+作者:Vivek Gite
+译者:[译者ID](https://github.com/译者ID)
+校对:[校对者ID](https://github.com/校对者ID)
+
+本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
\ No newline at end of file
diff --git a/sources/tech/Linux or UNIX grep Command Tutorial series/20151127 Linux or UNIX grep Command Tutorial series 5--Grep From Files and Display the File Name.md b/sources/tech/Linux or UNIX grep Command Tutorial series/20151127 Linux or UNIX grep Command Tutorial series 5--Grep From Files and Display the File Name.md
new file mode 100644
index 0000000000..6fa9dc7a27
--- /dev/null
+++ b/sources/tech/Linux or UNIX grep Command Tutorial series/20151127 Linux or UNIX grep Command Tutorial series 5--Grep From Files and Display the File Name.md
@@ -0,0 +1,67 @@
+Grep From Files and Display the File Name
+================================================================================
+How do I grep from a number of files and display the file name only?
+
+When there is more than one file to search it will display file name by default:
+
+ grep "word" filename
+ grep root /etc/*
+
+Sample outputs:
+
+ /etc/bash.bashrc: See "man sudo_root" for details.
+ /etc/crontab:17 * * * * root cd / && run-parts --report /etc/cron.hourly
+ /etc/crontab:25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
+ /etc/crontab:47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
+ /etc/crontab:52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
+ /etc/group:root:x:0:
+ grep: /etc/gshadow: Permission denied
+ /etc/logrotate.conf: create 0664 root utmp
+ /etc/logrotate.conf: create 0660 root utmp
+
+The first name is file name (e.g., /etc/crontab, /etc/group). The -l option will only print filename if th
+
+ grep -l "string" filename
+ grep -l root /etc/*
+
+Sample outputs:
+
+ /etc/aliases
+ /etc/arpwatch.conf
+ grep: /etc/at.deny: Permission denied
+ /etc/bash.bashrc
+ /etc/bash_completion
+ /etc/ca-certificates.conf
+ /etc/crontab
+ /etc/group
+
+You can suppress normal output; instead print the name of each input file from **which no output would normally have been** printed:
+
+ grep -L "word" filename
+ grep -L root /etc/*
+
+Sample outputs:
+
+ /etc/apm
+ /etc/apparmor
+ /etc/apparmor.d
+ /etc/apport
+ /etc/apt
+ /etc/avahi
+ /etc/bash_completion.d
+ /etc/bindresvport.blacklist
+ /etc/blkid.conf
+ /etc/bluetooth
+ /etc/bogofilter.cf
+ /etc/bonobo-activation
+ /etc/brlapi.key
+
+--------------------------------------------------------------------------------
+
+via: http://www.cyberciti.biz/faq/grep-from-files-and-display-the-file-name/
+
+作者:Vivek Gite
+译者:[译者ID](https://github.com/译者ID)
+校对:[校对者ID](https://github.com/校对者ID)
+
+本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
\ No newline at end of file
diff --git a/sources/tech/Linux or UNIX grep Command Tutorial series/20151127 Linux or UNIX grep Command Tutorial series 6--How To Find Files by Content Under UNIX.md b/sources/tech/Linux or UNIX grep Command Tutorial series/20151127 Linux or UNIX grep Command Tutorial series 6--How To Find Files by Content Under UNIX.md
new file mode 100644
index 0000000000..3d5943fc07
--- /dev/null
+++ b/sources/tech/Linux or UNIX grep Command Tutorial series/20151127 Linux or UNIX grep Command Tutorial series 6--How To Find Files by Content Under UNIX.md
@@ -0,0 +1,66 @@
+How To Find Files by Content Under UNIX
+================================================================================
+I had written lots of code in C for my school work and saved it as source code under /home/user/c/*.c and *.h. How do I find files by content such as string or words (function name such as main() under UNIX shell prompt?
+
+You need to use the following tools:
+
+[a] **grep command** : print lines matching a pattern.
+
+[b] **find command**: search for files in a directory hierarchy.
+
+### [grep Command To Find Files By][1] Content ###
+
+Type the command as follows:
+
+ grep 'string' *.txt
+ grep 'main(' *.c
+ grep '#include