https://github.com/branneman/jsgrep-cli
An alternative to grep which uses JavaScript's Regex, supports a match and a match-and-replace
https://github.com/branneman/jsgrep-cli
cli grep javascript js pcre regex tool
Last synced: about 1 year ago
JSON representation
An alternative to grep which uses JavaScript's Regex, supports a match and a match-and-replace
- Host: GitHub
- URL: https://github.com/branneman/jsgrep-cli
- Owner: branneman
- Created: 2018-05-17T08:25:14.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-23T11:41:17.000Z (about 8 years ago)
- Last Synced: 2025-04-05T20:46:32.983Z (about 1 year ago)
- Topics: cli, grep, javascript, js, pcre, regex, tool
- Language: JavaScript
- Homepage:
- Size: 39.1 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# jsgrep-cli
[](https://travis-ci.org/branneman/jsgrep-cli)
[](https://snyk.io/test/github/branneman/jsgrep-cli)
An alternative to grep which uses JavaScript's Regex, supports a match and a match-and-replace
## Installation
```
npm i jsgrep-cli -g
```
## Example
Match input from stdin, return any matching line:
```
ls -al ~ | jsgrep " \.[a-z]+rc$"
```
Match and replace lines from stdin. Capturing groups are exposed as `$1`, `$2`... variables (1-indexed), and must probably be escaped to prevent being interpreted by your shell:
```
ls -al ~ | jsgrep ".+ (\.[a-z]+rc$)" "\$1"
```
Passing flags (default `i`):
```
ls -al ~ | jsgrep " \.[a-z]+rc$" --flags iu
```