Improved local shell snippet rendering

This commit is contained in:
Michele Cereda
2022-05-15 00:24:53 +02:00
parent ba75b52244
commit d057f2210d
135 changed files with 313 additions and 298 deletions

View File

@@ -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'
```