Grep tool :

# grep (basic regular expression) vs grep -E (extended regular expression)
 
 
function getdata
{
cat <<'EOF'
abcdef
bbcdef
cccdef
ddddef
eeeeef
ffffff
EOF
}
 
#Basic
echo "1. a or b"
getdata | grep   --color "\(a\|b\)"
echo "2. a or b"
getdata | egrep  --color "(a|b)"
 
 
echo "1.   4 d"
getdata | grep   --color "d\{4\}"
echo "2.   4 d"
getdata | egrep  --color  "d{4}"
 
 
 
 
#Back References 
echo "1.    f and back ref"
getdata | grep  --color "\(f\)\1"
echo "2.    f and back ref"
getdata | egrep --color "(f)\1"
 
 
 
echo "1.    (not e or not f )and back ref"
getdata | grep  --color "\([^e]\|[^f]\)\1" 
echo "2.    (not e or not f) and back ref"
getdata | egrep --color "([^e]|[^f])\1" 
 
 
#ip adresse xxx.xxx.xxx.xxx
egrep "([0-9]{1,3}\.){3}[0-9]{1,3}"
 
#mac adresse xx:xx:xx:xx:xx:xx
egrep "([0-9a-fA-F]{2}\:){5}[0-9a-fA-F]{2}"