Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add grep.md #1223

Merged
merged 4 commits into from
Sep 27, 2021
Merged

Add grep.md #1223

merged 4 commits into from
Sep 27, 2021

Conversation

mtking2
Copy link
Contributor

@mtking2 mtking2 commented Oct 4, 2019

This PR adds a cheatsheet for the grep command.

Resolves #161
Closes #1170

### Usage
{: .-prime}

```bash

This comment was marked as resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use bash for the code blocks because that's what prism uses for the syntax highlighting.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

grep.md Outdated
### Pattern Options

```bash
-E, --extended-regexp # extended regular expression
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a brief summary of how ERE, BRE and PCRE differ, something like https://indigo.re/posts/2020-11-11-cli-regex.html#pattern-types

and maybe reorder from least powerful to most powerful: -F, -G, -E, -P

```bash
-A NUM, --after-context=NUM # print NUM lines after a match
-B NUM, --before-context=NUM # print NUM lines before a match
-C NUM, -NUM, --context=NUM # print NUM lines before and after a match

This comment was marked as resolved.

grep.md Outdated
@@ -0,0 +1,64 @@
---
title: Grep
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cheatsheet are options of GNU grep, not of POSIX grep. POSIX grep has much less options (one example: it doesn't have PCRE)

@mtking2
Copy link
Contributor Author

mtking2 commented Aug 24, 2021

@hydrargyrum updated 👍 Let me know what you think.

@pull-request-size pull-request-size bot added size/L and removed size/M labels Sep 27, 2021
@rstacruz rstacruz merged commit 154c4af into rstacruz:master Sep 27, 2021
@rstacruz
Copy link
Owner

Awesome, thank you so much for this!

@detro
Copy link

detro commented Sep 27, 2021

This is awesome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cheatsheet request: grep Cheatsheet request: GREP
4 participants