Skip to content

Search and audit content

Use find to walk a page tree, then filter paths with a pipe or search page bodies with -exec grep.

$ find . -exec grep -i 'old product name'
$ find ./Docs -maxdepth 2 -exec grep error
$ find -name '*Notes*' -exec grep -i TODO
$ find ./Docs -exec grep -c error

Each matching page is introduced with its path, then the matching lines. With -c, Shell prints path:count and omits pages with no matches.

This is not the same as filtering find’s output:

CommandWhat it searches
find … | grep PATTERNPath strings (titles / paths)
find … -exec grep PATTERNPage bodies of the pages find enumerates

-exec supports grep only. Reuse grep’s -i / -v / -n / -c.

Related: grep

$ tree ./Docs
$ tree -L 2
$ find ./Docs | wc
$ find . -maxdepth 1
$ find ./Docs | head 20
$ ls | sort -r | head 5

tree prints an ASCII page tree (default depth 3; use -L / --maxdepth to change it). find prints the start path, then descendants, so find ./Docs | wc is one plus the number of descendants (subject to the caps below). The default -maxdepth for find is 5 if you omit it.

wc prints a line count (wc and wc -l are the same). sort is a lexicographic sort; -r reverses it.

$ grep -n keyword ./page
$ grep -c keyword ./page
$ cat ./page | head 20
$ cat ./page | grep -i error | head 20

You can pass a page path directly to grep, head, or tail, or pipe cat into those filters.

  • Results are capped at 5000 paths. Child API fetches are capped at 250 per find. If a cap is hit, Shell prints what it collected and a marker asking you to refine with -maxdepth or -name.
  • -exec grep fetches at most 100 page bodies.
  • While a command shows working…, press Esc or Ctrl+C to interrupt it.