Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

srcgrep

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

srcgrep

Grep through entire source tree based on an expression or string

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

srcgrep

Grep through entire source tree based on an expression or string. Will output line file and line number of matched expression.

Example

Searching the source code of all files in the path provided, including file and line number.

$ srcgrep -e '\$path.*' -i -p /var/www/apps/myapp
  /var/www/apps/myapp/myfile.pl:50:    my ($path, $ignore, @regexp, $test, $outfile, @patterns, @excludes);
  /var/www/apps/myapp/myfile.pl:55:    "p|path:s" => \$path,
  /var/www/apps/myapp/myfile.pl:69:    if ("$path") {

Install

npm install -g srcgrep

Usage:

Usage:  srcgrep [OPTIONS] -e PATTERN [-e PATTERN, -e ...]

The output will be in FILENAME:LINE#:LINE format convenient for gvim.

Options:

-h, --help     This usage statement.

-i, --ignore   Ignore case when searching.

-E, --exclude   Exclude filename pattern.

-o, --outfile  Produce an outfile of results in /tmp.  The file
    will be named srcgrep-YYYYmmddHHMMSS.

-t, --test     Do not run the search, but print the command instead.

-p, --path     Path to search.  If left empty, the script will try to
    find the source directory.

-e, --regexp   Search pattern using regular expressions. Additional
    patterns will result in OR searches


EXAMPLES:

To find source files matching either 'File' or 'Foo bar':
srcgrep -e File -e 'Foo bar'

To find files in /tmp with lines starting with Test or test:
srcgrep -i -p /tmp -e '^test'

License

MIT License

Keywords

FAQs

Package last updated on 13 Jan 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc