Monday, 17 July 2017

How to search multiple keywords in a file ?


Use egrep command

egrep -e '^TEXT|^TEXT|TEXT' <file>

egrep -e '^bind| port |pidfile|^logfile' /opt/redis/etc/8000.conf

It will search and give lines corresponding to given keywords :
bind 3200
listen port 800
master pidfile /logs/a.pid
logfile mylogs.log