M HYPE SPLASH
// updates

how to grep something with a wildcard path?

By John Campbell

I want to grep a Gemfile in few rails apps. But for each rails app there are many branches and out of which the latest branch name lets say is 'main'.

The structure is something like this:

workspace rails-apps rails-app1 main feature-branch rails-app2 main feature-branch feature-branch2

So I am doing something like this:

grep -R "rails" /workspace/rails-apps/ --include="Gemfile"

but when I do this it greps all the Gemfiles in all the branches which I dont want. I just need to grep only Gemfile in main branch.

Something like this:grep -R "rails" /workspace/rails-apps/*/main --include="Gemfile"but it doesnt work.

0

1 Answer

Have you tried this?

grep -R "rails" /workspace/rails-apps/*/main/Gemfile
3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy