egrep : This command stands for extended grep.It is a combination of grep & fgrep along with some additional wild card characters.
Additional wild card characters like:
a)( | ) : It matches any one string in the given list.
Ex : $egrep "(oracle|java|unix)" output
It matches either oracle or java or unix strings.
b){m}: It matches exact occurrences of its preceding character or number.
Ex :$egrep "\<[0-9]{4}\>" num
It matches exact 4 digit number.
Ex: $egrep "\<[a-z]{4}\>" sample
It matches exact 4 digit string.
Ex: $egrep "\<ab{3}c\>" demo
It matches exact occurrence of its preceding number.
c){m,n}:It matches minimum 'm' occurrences and maximum 'n' occurrences of it's preceding character.
Ex: $egrep "\<ab{3,5}c\>" demo
Ex: $egrep "\<[0-9]{3,6}\>" num
It matches 3 or 4 or 5 or 6 digit numbers.
d){m,}: It matches minimum 'm' occurrences of its preceding character.
Ex :$egrep "\<ab{3,}c\>" demo
Ex :$egrep "\<[0-9]{3,}\>" num
It display minimum 3 digit number.
Additional wild card characters like:
a)( | ) : It matches any one string in the given list.
Ex : $egrep "(oracle|java|unix)" output
It matches either oracle or java or unix strings.
b){m}: It matches exact occurrences of its preceding character or number.
Ex :$egrep "\<[0-9]{4}\>" num
It matches exact 4 digit number.
Ex: $egrep "\<[a-z]{4}\>" sample
It matches exact 4 digit string.
Ex: $egrep "\<ab{3}c\>" demo
It matches exact occurrence of its preceding number.
c){m,n}:It matches minimum 'm' occurrences and maximum 'n' occurrences of it's preceding character.
Ex: $egrep "\<ab{3,5}c\>" demo
Ex: $egrep "\<[0-9]{3,6}\>" num
It matches 3 or 4 or 5 or 6 digit numbers.
d){m,}: It matches minimum 'm' occurrences of its preceding character.
Ex :$egrep "\<ab{3,}c\>" demo
Ex :$egrep "\<[0-9]{3,}\>" num
It display minimum 3 digit number.
Explained GREP UNIX command with amazing live example in this video
ReplyDeletehttps://youtu.be/1WEZqImoxzs
:: SUBSCRIBE , SHARE , LIKE & COMMENT ::