About this tool
Build correct grep and ripgrep commands with context lines, include and exclude globs, and safe shell quoting.
This builder assembles a ready-to-paste grep or ripgrep command from checkboxes for case handling, whole-word matching, context lines (-A/-B/-C), include and exclude globs, and output modes like -l and -c. Every pattern and glob is quoted with POSIX single-quote rules, so patterns containing spaces, apostrophes or shell metacharacters run exactly as written. It is built for developers and sysadmins who know what they want to find but not which flag spelling GNU grep or rg uses for it.
Open Grep Command Builder on AltFTool — it loads instantly in your browser.
Paste your code or data sample into the workspace.
Pick the format, conversion, or analysis you need.
Copy the polished result straight back into your project.
Patterns with quotes, spaces or metacharacters are wrapped using POSIX single-quote escaping automatically.
The same options render as GNU grep flags (--include, -r, -E) or ripgrep flags (-g, -S, --hidden) with one switch.
Combinations like -c with -l or -E with -F produce a plain-language warning instead of silent surprises.
Use grep -r --include='*.ext' PATTERN DIR, or with ripgrep rg -g '*.ext' PATTERN DIR. GNU grep's --include and --exclude filters only apply while it is descending directories, so they need -r to have any effect; ripgrep recurses and respects .gitignore by default.
-A N prints N lines after each match, -B N prints N lines before it, and -C N prints N lines on both sides. -C N is exactly equivalent to -A N -B N, which is why this builder collapses equal before/after values into a single -C flag.
Pass it with -e, for example grep -e '-foo' file, otherwise grep parses the pattern as a flag and errors. Both GNU grep and ripgrep support -e/--regexp for this, and the builder adds it automatically whenever your pattern begins with a hyphen.
Not by default. ripgrep skips hidden files and directories and anything matched by .gitignore; add --hidden to include hidden files and --no-ignore to bypass ignore files, or -uu as a shorthand for both. GNU grep has no such filtering and searches whatever it is pointed at.