New post as I'm learning more about grep and grep in emacs specifically:

@kensanata @eludom @jackbaty if you want to give it a look and tell me how much more I can add... feel free ;)

· · Web · 2 · 1 · 2

@jtr I feel that in the paragraph where you talk about grep piped into another grep, you didn't discuss the importance of matching lines. If the file contains a line with the word "restaurant" and the word "burger" on a different line, grep restaurant filename | grep burger will return no results. You do call it "basic results" but what does that mean? An example would be good, I think.

Example file 1:
This is a burger restaurant.

Example file 2:
I went to a restaurant.
They sold black bean burgers.

@jtr three alternatives also with individual drawback

1. single pattern:

-e "burger.*rest\|rest.*burger"

disad. everything between burger and rest is highl.

GNU grep with PCRE (-P instead of -e)

-P "(?=.*burger)(?=.*rest)"

disad. nothing is highl.

2. process substitution instead of pipe e.g. bash

-e burger <(grep rest *.org)

disad. (like pipe) only /last/ term is highl.

3. occur on occur buffer - n search terms. All highl.

disad. n return presses to /jump/ to match

Sign in to participate in the conversation
Mastodon for Tech Folks

This Mastodon instance is for people interested in technology. Discussions aren't limited to technology, because tech folks shouldn't be limited to technology either!