Skip to content

Native command line grep-like file search utility for Windows. Simple, fast, easy to use.

License

Notifications You must be signed in to change notification settings

sLill/Windows-Grep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Windows Grep logo

Windows Grep

CodeFactor .NET Core

Command line grep-like file search utility for Windows.

No bloated gui or custom console. Just a fast, simple tool that runs in native cmd/powershell.

Supports

- Regular Expressions
- Chained commands
- Filter by Filetype/Filepath/Filesize
- Exports
- Mass replace/delete
- Ease of use: Run from cmd, Powershell and Windows Explorer

INSTALLATION

Installer

  1. Visit the release tab (https://github.com/sLill/Windows-Grep/releases)
  2. Download and run WindowsGrepSetup.msi (This is the only file you need)

This will install Windows Grep in Program Files (x86), add "grep" to PATH for command line use, and insert a registry key for context menu use within Windows Explorer.

Manual Compilation

  1. Clone repo and build the WindowsGrep project as Release
  2. Publish WindowsGrep
  3. Download Wix Toolset & Wix VS Extension
  4. Build the WindowsGrep.Setup project to generate a msi installer in the WindowsGrep.Setup bin

USAGE

Right-click in File Explorer > Windows Grep

OR

Open cmd/powershell > "grep [command]"

image

REFERENCE

Recursive Search -r --recursive
Target Directory -d --directory=
Context Characters -c --context=
Limit n Results -n --results=
Suppress output -s --suppress
Ignore Line Breaks -b --ignore-breaks
Ignore Case -i --ignore-case
Target File -f --file=
Plain Text Search -F --fixed-strings
Regular Expression Search -G --basic-regexp
Filter Files by Type(s) [Inclusive] -t --filetype-filter=
Filter Files by Type(s) [Exclusive] -T --filetype-exclude-filter=
Filter Filepath(s) by Expression(s) [Inclusive] -p --path-filter=
Filter Filepath(s) by Expression(s) [Exclusive] -P --path-exclude-filter=
Filenames Only -k --filenames-only
FileSize Minimum -z --filesize-minimum=
FileSize Maximum -Z --filesize-maximum=
Write Output to File -w --write=
Replace Text -RX --replace=
Delete Files -DX --delete-files
File Hashes --hash= (0=SHA256, 1=MD5)

* See documentation for detailed command descriptions

Command Order
Order of flags and the search term is completely flexible


EXAMPLE COMMANDS

Recursive search for file content containing "Dug".
-r Dug

Recursive search for file names containing "Dug".
-r -k Dug

Search for file content containing "Dug" or "Dig". ignore-case.
-i D[ui]g

Filter for .txt and .cs files only. Additionally, filter out files in bin and obj subdirectories
Dug -t .txt;.cs -P bin;obj

Show 100 characters of context around the match.
Dug -c 100

Search for filenames containing "Dug". Additionally, search the files returned from command one for content containing "mike"
-r Dug -k | -i mike

Match phone number
[+]?[(]?[0-9]{3}[)]?[-\s.]?[0-9]{3}[-\s.]?[0-9]{4,6}

Recursive search. US zipcode expression. Filter out .dll matches. Limit results 10. Write output to .csv
-r \d{5}(-\d{4})? -T .dll -n 10 -w 'C:\output.csv'

For even more examples and detailed descriptions of each flag, visit the wiki