mirror of
https://gitea.com/mcereda/oam.git
synced 2026-02-09 05:44:23 +00:00
Improved local shell snippet rendering
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
## TL;DR
|
||||
|
||||
```shell
|
||||
```sh
|
||||
# base search
|
||||
grep 'pattern' path/to/search
|
||||
|
||||
@@ -39,7 +39,7 @@ For simple searches, you might want to use [pdfgrep].
|
||||
Should you need more advanced grep capabilities not incorporated by pdfgrep, you might want to convert the file to text and search there.
|
||||
You can to this using [pdftotext](pdfgrep.md) as shown in this example ([source][stackoverflow answer about how to search contents of multiple pdf files]):
|
||||
|
||||
```shell
|
||||
```sh
|
||||
find /path -name '*.pdf' -exec sh -c 'pdftotext "{}" - | grep --with-filename --label="{}" --color "your pattern"' ';'
|
||||
```
|
||||
|
||||
@@ -48,7 +48,7 @@ find /path -name '*.pdf' -exec sh -c 'pdftotext "{}" - | grep --with-filename --
|
||||
- Standard editions of `grep` run in a single thread; use another executor like
|
||||
`parallel` or `xargs` to parallelize grepping multiple files:
|
||||
|
||||
```shell
|
||||
```sh
|
||||
find . -type f | parallel -j 100% grep 'pattern'
|
||||
find . -type f -print0 | xargs -0 -n 1 -P $(nproc) grep 'pattern'
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user