Tools cover

Search Inside DOCX Files with ripgrep and pandoc

DOCX files are binary ZIP archives and rg can’t search them directly. The fix is to pipe each file through pandoc, which converts DOCX to plain text (or Markdown) on the fly before rg searches it. Prerequisites Install both tools if you don’t have them: winget install BurntSushi.ripgrep.MSVC winget install JohnMacFarlane.Pandoc Search all DOCX files recursively Get-ChildItem *.docx -Recurse | % { echo "---" echo $_.Name pandoc $_.FullName -t markdown | rg -i 'my search string' } Argument Meaning *.docx Glob pattern, match only .docx files -Recurse Walk subdirectories recursively % Alias for ForEach-Object, runs the block for each file $_.FullName Full absolute path of the current file (required by pandoc) -t markdown Tell pandoc to output Markdown; preserves heading structure so you can see where in the document a match falls -i Case-insensitive search in ripgrep 'my search string' The search query (use single quotes in PowerShell to prevent string interpolation) Show context around matches Use -C to print lines before and after each match: ...

May 3, 2026
Tools cover

ripgrep: Search for a String Literal

Doing a literal search with ripgrep is easy and can be done with the -F parameter. To search for a string literal and not a regex, use: rg -F 'my string literal' Searching for a string literal is useful when you have to look for a string that ripgrep would interpret as regex (this behavior is by default). This is often the case when searching for snippets of code. For example, ...

October 29, 2024
Tools cover

ripgrep: Suppress 'Access is Denied' error message

Ripgrep (rg) is a popular command-line search tool inspired by the popular GNU grep tool. The Access is denied. (os error 5) is a common error message that appears when trying to read a file or directory that ripgrep does not have permission to access. This can be annoying when doing a system wide search when many system directories or other protected directories may be searched, littering the results with many “access is denied” error messages. Luckily the messages can be suppressed. ...

September 10, 2024
Tools cover

ripgrep: Search Stats and Match Count

When searching through large code bases or directories, it’s helpful to get a sense of how many matches were found by your search query. While tools like ripgrep can give you the exact lines where a match was found, they don’t always provide an easy way to see the total number of hits. This is where ripgrep --stats and --count comes in. With these arguments we can get stats about what was found and results per file. ...

September 9, 2024