This is an old revision of the document!
grep регулярное_выражение [имя_файла]''
$ grep root /etc/passwd
$ ps -ax | grep init
$ tail –f /var/log/maillog | grep init
$ grep '^root' /etc/passwd
$ grep 'sh$' /etc/passwd
Ключ -r - рекурсивный перебор подкаталогов
$ grep -r '\<sed\>' /usr/share | more
Ключ -v - показать строки, не совпадающие с шаблоном
$ grep -v '^#' /etc/defaults/rc.conf | more
$ grep -v '^#\|^$' /etc/defaults/rc.conf | more
Ключ -E - использовать расширенные регулярные выражения
$ grep -vE '^#|^$' /etc/defaults/rc.conf | more
$ egrep -v '^#|^$' /etc/defaults/rc.conf | more
$ egrep -v '^ *#|^$' /usr/local/etc/apache/httpd.conf | more