grep

# view config file without comments
grep ^[^#] <FILE>
 
# search multiple string with grep
grep -w 'warning\|error\|critical' /var/log/messages
grep -E 'warning|error|critical' /var/log/syslog
 
# displaying file without commentary and empty lines
egrep -v '^(#|$)' FILE_NAME
 
# grep list only the file name
grep PATTERN -o *
 
# search field and show one after
hwinfo --network | egrep "Permanent HW Address|SysFS ID" | egrep -A1 "eth" | paste - - | sort | column -t
 
# grep between pattern
grep -o -P '(?<=-foo ).*(?= -bar)'
 
# exclude from file
cat in.txt | grep -vf exlude.txt > out.txt
 
# find files NOT contain string
grep -L foo *