grep command. A regular expression is a pattern that describes a set of strings. Regular expressions are constructed analogously to arithmetic expressions, by using various operators to combine smaller expressions.
grep understands three different versions of regular expression syntax: “basic,” “extended” and “perl.” In GNU grep, there is no difference in availablefunctionality between basic and extended syntaxes. In other implementations,basic regular expressions are less powerful.
The fundamental building blocks are the regular expressions that match a single character. Most characters, including all letters and digits, are regular expressions that match themselves. Any meta-character with special meaning may be quoted by preceding it with a backslash.
Follow us on Social Networking Sites
Facebook Page: / linuxarkit
LinkedIn Profile: / ravi-kumar-94530121
Google Plus: https://plus.google.com/u/0/+RedhatEn...
Youtube: / freeonlinetechvideos
Twitter: / aravikumar48
RSS Feed: https://feedburner.google.com/fb/a/ma...
GetPocket: https://getpocket.com/@em6gvd95p09cFA...
Reddit: / aravikumar48
Tumblr: https://www.tumblr.com/blog/aravikumar48
grep command options
-c : Print only count which matches the pattern
-h : Display matched lines only
-i : Ignore Upper case or Lower case (Non-case sensitive)
-l : Display only file names
-n : Pattern matches lines and thier line numbers
-v : Ignore the pattern and match except
-e exp : Expression with this option. Can use multiple times.
-f file : Takes patterns from file, one per line.
-E : Extended regular expressions or egrep
-w : Match pattern with whole word
-o : Print only the matched parts of a matching line, with each such part on a separate output line.
grep command examples
rpm -qa |grep grep
grep first fotv
grep First fotv
grep -i fist fotv
grep -i first fotv
ls -l |grep fotv
ls -l |grep -i FOTV
grep -v First fotv
grep -v -e "First" -e "last" fotv
grep -iv -e "First" -e "last" fotv
grep -i -e "First" -e "last" fotv
grep below -A 2 fotv
grep below -A 1 fotv
grep below -B 2 fotv
grep below -C 1 fotv
grep below -C 2 fotv
grep -ril fotv
grep -riL fotv
grep --color=auto Unix fotv
grep -c line fotv
grep -ic line fotv
grep -c line fotv
grep -l line fo*
grep "^First" fotv
grep "^First" fotv
grep "demo$" fotv
grep -o First
grep -w "file First" fotv
grep -E 'Unix|Linux' fotv
grep -P Unix fotv
Watch video Linux Command Line Tutorial | grep command | 15 Amazing Practical Examples | FOTV online without registration, duration hours minute second in high quality. This video was added by user Dilkush 05 May 2018, don't forget to share it with your friends and acquaintances, it has been viewed on our site 3,26 once and liked it 4 people.