Last Updated: February 25, 2016
·
408
· hellovic

Search for a string in (all) files inside a directory

grep -r -n "THE STRING" ./*.html -A 3 -B 2

grep options:

  • ./*.html all html in current directory

  • -r recursive

  • -i case insensitive

  • -n show line number

  • -A lines after match

  • -B lines before match