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

find ebooks that match all the search strings #210

Open
blueray453 opened this issue Feb 6, 2024 · 1 comment
Open

find ebooks that match all the search strings #210

blueray453 opened this issue Feb 6, 2024 · 1 comment

Comments

@blueray453
Copy link

Is your feature request related to a problem? Please describe.

I want to find all files which have the words:

  • all-or-nothing
  • pervasive
  • catastrophizing

I mean all words have to be present in the file. They do not need to be in the same line, paragraph or page.

Describe the solution you'd like

When I use: rga --word-regexp --sort path --ignore-case --files-with-matches --regexp "A1" --regexp "A2", i think the --regexp work as or. I need a operator that will work as and, something like --and "A1" --and "A2"

Describe alternatives you've considered

I am currently using:

comm -12 <(rga 'A1' --ignore-case --files-with-matches | sort) \
<(rga 'A2' --ignore-case --files-with-matches | sort) \
| comm -12 - <(rga 'A3' --ignore-case --files-with-matches | sort) \
| comm -12 - <(rga 'A4' --ignore-case --files-with-matches | sort)

However, this is not optimal.

@geff10
Copy link

geff10 commented Feb 17, 2024

I think maybe it should be in ripgrep itself, or in other wrapper.

By the way, I would be happy to see a similar feature, but for me it would be more practical to filter those findings where both words are in the same line. It is also solvable with some regex magic but it would be handy to simplify this usecase. (I'm considering implementing this feature myself if I cannot find a ready solution.)

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

No branches or pull requests

2 participants