Grep for a string in all files in a directory and its subdirectories with a certain extension

/ Published in: Bash
Save to your folder(s)

Searches all HTML files in current directory and subdirectory for the string "cookiemonster.html". Can be used to find which pages link to a page. Further tweaks can find which source files directly include a file. Both file names and the search string are case insensitive.

Copy this code and paste it in your HTML
  1. fgrep -i 'cookiemonster.html' `find . -iname '*.html' -print`

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.