All Projects → drmohundro → Find-String

drmohundro / Find-String

Licence: MIT license
A PowerShell script to provide functionality similar to grep or ack with highlighting.

Programming Languages

powershell
5483 projects

Labels

Projects that are alternatives of or similar to Find-String

Ack2
**ack 2 is no longer being maintained. ack 3 is the latest version.**
Stars: ✭ 1,504 (+2585.71%)
Mutual labels:  ack, grep
vim-bettergrep
A better way to grep in vim.
Stars: ✭ 15 (-73.21%)
Mutual labels:  ack, grep
config
holy cow, wholly config! Vim, Zshell, Ack, & the rest of my dot-files.
Stars: ✭ 21 (-62.5%)
Mutual labels:  ack
ngp
Ncurses code parsing tool
Stars: ✭ 52 (-7.14%)
Mutual labels:  grep
biowasm
WebAssembly modules for genomics
Stars: ✭ 115 (+105.36%)
Mutual labels:  grep
writable search.vim
Grep for something, then write the original files directly through the search results.
Stars: ✭ 47 (-16.07%)
Mutual labels:  grep
vim-agriculture
🚜 Vim plugin to improve project searching with tools like ag and rg
Stars: ✭ 119 (+112.5%)
Mutual labels:  ack
sif
A minimal (and experimental) ACK written in Go
Stars: ✭ 20 (-64.29%)
Mutual labels:  ack
greptile
Fast grep implementation in python, with recursive search and replace
Stars: ✭ 17 (-69.64%)
Mutual labels:  grep
CoCoC
C development system for (Nitr)OS9/6x09, with source
Stars: ✭ 22 (-60.71%)
Mutual labels:  grep
tmuxjump.vim
A plugin to open file from file paths printed in sibling tmux pane
Stars: ✭ 50 (-10.71%)
Mutual labels:  grep
ogrep-rs
Outline grep — search in indentation-structured texts (Rust version)
Stars: ✭ 32 (-42.86%)
Mutual labels:  grep
so stupid search
It's my honor to drive you fucking fire faster, to have more time with your Family and Sunshine.This tool is for those who often want to search for a string Deeply into a directory in Recursive mode, but not with the great tools: grep, ack, ripgrep .........every thing should be Small, Thin, Fast, Lazy....without Think and Remember too much ...一…
Stars: ✭ 135 (+141.07%)
Mutual labels:  grep
psgrep
A simple little shell script to help with the "ps aux | grep" idiom.
Stars: ✭ 26 (-53.57%)
Mutual labels:  grep
funboost
pip install funboost,python全功能分布式函数调度框架,。支持python所有类型的并发模式和全球一切知名消息队列中间件,python函数加速器,框架包罗万象,一统编程思维,兼容50% python编程业务场景,适用范围广。只需要一行代码即可分布式执行python一切函数。旧名字是function_scheduling_distributed_framework
Stars: ✭ 351 (+526.79%)
Mutual labels:  ack
ast-grep
🔍 Like grep, but more powerful than you can possibly imagine
Stars: ✭ 14 (-75%)
Mutual labels:  grep
grep-typos
Quickly check your project for typos
Stars: ✭ 41 (-26.79%)
Mutual labels:  grep
webgrep
Grep Web pages with extra features like JS deobfuscation and OCR
Stars: ✭ 86 (+53.57%)
Mutual labels:  grep
gf-patterns
Collection grep patterns for Tom Hudson a.k.a Tomnomnom tools namely gf
Stars: ✭ 27 (-51.79%)
Mutual labels:  grep
DFIRRegex
A repo to centralize some of the regular expressions I've found useful over the course of my DFIR career.
Stars: ✭ 33 (-41.07%)
Mutual labels:  grep

Find-String

Join the chat at https://gitter.im/drmohundro/Find-String

Find-String is a PowerShell script whose purpose is to emulate grep and/or ack. PowerShell already has the built-in Select-String cmdlet, but this script wraps Select-String and provides match highlighting on top of the searching capabilities.

It currently highlights matches in a similar style to ack.

screenshot

Examples

Find all usages of form in all .cs files:

find-string form *.cs

Find the unique file extensions from all of the files that have the string 'jquery' in them:

find-string jquery -passThru |
    Select-Object -ExpandProperty Path |
    Select-String '.\.(\w+)$' |
    Select-Object -ExpandProperty Matches |
    ForEach-Object { $_.Groups[1].Value } |
    Select-Object -Unique

Or the same example using built-in aliases (more succinct, likely reflects more typical usage):

find-string jquery -pass |
    select -expand path |
    select-string '.\.(\w+)$' |
    select -expand matches |
    %{ $_.groups[1].value } |
    select -uniq

Installation

PowerShell Gallery Install

This method of installation requires PowerShell v5 or higher.

  • Run Install-Module Find-String

See Find-String on PowerShell Gallery.

PsGet Install

  • Install PsGet
  • Run Install-Module Find-String

See Find-String on PsGet for more details.

Manual Install

Clone (or download) the repository to:

  • If PowerShell 5
    • ~/Documents/WindowsPowerShell/Modules/Find-String
  • If PowerShell Core on Windows
    • ~/Documents/PowerShell/Modules/Find-String
  • If Mac/Linux
    • ~/.local/share/powershell/Modules/Find-String

Alternative Tools

I like options, so I want to ensure everyone is aware of the other tools out there. My current preferred tool is RipGrep.

  • Grep - "Grep searches one or more input files for lines containing a match to a specified pattern."
  • Ack - "ack is a code-searching tool, similar to grep but optimized for programmers searching large trees of source code."
  • The Silver Searcher (aka AG) - "A code-searching tool similar to ack, but faster."
  • The Platinum Searcher (aka PT) - "A code search tool similar to ack and the_silver_searcher(ag). It supports multi platforms and multi encodings."
  • RipGrep (aka RG) - "ripgrep recursively searches directories for a regex pattern"

Editor Integration

Vim

See find-string.vim. Installation should be a simple Plug 'drmohundro/find-string.vim' if you use vim-plug.

Options

  • -pattern
    • Specifies the text to find. Type a string or regular expression.
    • Required
  • -filter
    • Specifies the file types to search in. The default is all file types (*.*).
  • -include
    • Specifies the file types to search in. This allows you to search across multiple file types (i.e. *.ps1,*.psm1).
  • -excludeFiles
    • Specifies the file types to exclude from searches. If set, this overrides any global defaults or configuration.
    • Comma-separated list of files to exclude from the search
  • -excludeDirectories
    • Specifies the directories to exclude from searches. It really only makes sense for recursive searches. If set, this overrides any global defaults or configuration.
    • Comma-separated list of directories to exclude from the search
  • -path
    • Specifies the path to the files to be searched. Wildcards are permitted. The default location is the local directory.
  • -recurse
    • Gets the items in the specified path and in all child directies. This is the default.
  • -caseSensitive
    • Makes matches case-sensitive. By default, matches are not case-sensitive.
  • -context
    • Captures the specified number of lines before and after the line with the match. This allows you to view the match in context.
    • Example:
      • find-string foo *.cs -context 2,3
      • Would return a context of 2 lines before the match and 3 lines after the match
  • -passThru
    • Passes the literal MatchInfo object representing the found match to the pipeline. By default, this cmdlet does not send anything through the object pipeline.
    • This is useful if you wish to do additional processing on the results, such as collect any matches in a regular expression that you searched for or to gather unique results.
  • -pipeOutput
    • Sends all output along the object pipeline. By default, this command uses color to help with readability; however, this prevents the output from being piped to another command. If you wish to pipe the output of this command to something else, be sure to use this parameter.
    • This is useful if you wish to pipe the output to the clipboard.
    • Example:
      • find-string foo *.cs -pipeOutput | clip
  • -listMatchesOnly
    • Returns all files that have matches existing in them, but doesn't display any of the matches themselves.

Changelog

See CHANGELOG for a list of all changes and their corresponding versions.

License

Find-String is released under the MIT license. See LICENSE for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].