Tags

Erstes Wort

grep -Eo '^[^ ]+'

Letztes Wort

grep -oE '[^ ]+$'

extract IP addresses

grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'| 

exclude lines which begin with "#" or ";"

grep "^[^#;]" 

exclude empty lines and contain #

egrep -v '#|^$'

exclude lines which contain with "//"

grep -v "//"

exclude lines which are empty

grep -ve '^$'

phrase

grep "Host not found" /var/log/mail.*

➜  ~ alias G "G"
G='| grep'
 

  1. https://devhints.io/grep