Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mcommer/findngrep
Trying to ease your typing life when using find-grep command combinations
https://github.com/mcommer/findngrep
Last synced: 24 days ago
JSON representation
Trying to ease your typing life when using find-grep command combinations
- Host: GitHub
- URL: https://github.com/mcommer/findngrep
- Owner: mcommer
- License: mit
- Created: 2024-11-25T20:58:13.000Z (about 1 month ago)
- Default Branch: main
- Last Pushed: 2024-12-04T15:25:15.000Z (about 1 month ago)
- Last Synced: 2024-12-04T15:34:13.959Z (about 1 month ago)
- Language: Shell
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# findngrep
findngrep is a bash shell script combining find-grep commands in a manner
that tries to ease your typing-life.For example, under my directory `~/usr/local`, I am looking for all `*.cpp` source files which contain the two strings *classio* and *seek*. A first start would be something like:
```shell
find ~/usr/local -name '*.cpp' -exec grep -i classio {} \; | grep -i seek
```
which in my example case produces this:
```shell
perror("classio: lseek");
perror("classio: lseek");
perror("classio: lseek");
```
Great, but which files contain these matching lines, and what are their line numbers?
Of course, you can start tweaking the above command accordingly, probably ending up
with a long command. Let's skip this and just show the alternative:
```shell
findngrep -f "~/usr/local -name '\*.cpp'" -i -t classio seek
```
which produces this (the tree-display is optional):
![fig1:findngrep output](fig1.png)findngrep tells me the matching files (here, it's only one) together with line-number information.
## Installation
If the above seems useful to you, just put the script `findngrep` in your executable path and type
```shell
findngrep -h
```
for a help screen and more examples (q to exit help).