windows-safe-grep

Search Windows-style paths with spaces using find and grep.

Updated Jul 8, 2022
One-click install
npx skills add https://github.com/limaon/dotfiles --skill windows-safe-grep
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: windows-safe-grep
Source: https://github.com/limaon/dotfiles/tree/main/.config/opencode/skills/windows-safe-grep
Command: npx skills add https://github.com/limaon/dotfiles --skill windows-safe-grep

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This Skill provides a safe way to search Windows-style file paths that contain spaces and backslashes, preventing ripgrep from misinterpreting sequences like nul.

Core Features & Use Cases

  • Safe grep across Windows-style paths using Bash utilities
  • Supports path normalization with forward slashes
  • Fallback to find + grep when ripgrep is unavailable
  • Use Case: Scan codebases with mixed path formats and large directories for a keyword

Quick Start

bash safe-grep.sh 'polar_product_id' "/d/Projects/Vibe Code/isometricid/src"

Frequently Asked Questions about windows-safe-grep

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I search code on Windows paths with spaces without grep failing?

To search code on Windows paths with spaces safely, you must preprocess paths to escape backslashes and normalize forward slashes. This prevents search utilities from misinterpreting sequences like nul and ensures reliable code search.

What is the best way to run a bash grep search on Windows-style file paths?

The best way to run a bash grep search on Windows-style file paths is to normalize backslashes to forward slashes before querying. This avoids shell misinterpretation and allows reliable keyword scanning across project directories.

Can I use find and grep as a fallback when ripgrep is unavailable on Windows?

Yes, you can use find and grep as a reliable fallback for code search when ripgrep is unavailable. This approach successfully locates and scans files within Windows-style paths containing spaces.

Why does ripgrep misinterpret sequences like nul when scanning Windows paths?

Ripgrep misinterprets sequences like nul because unescaped backslashes in Windows paths trigger special pattern matching rules. Preprocessing paths to normalize slashes and escape characters prevents this search failure.

How do I normalize backslashes to forward slashes for a safe code search?

You normalize backslashes to forward slashes by preprocessing the target directory string before passing it to the search utility. This path normalization step is required for safe code search across mixed path formats.