DEV Community

Murahashi [Matt] Kenichi
Murahashi [Matt] Kenichi

Posted on • Edited on

git grep in subdirectories

git grep in subdirectories, then show the result of git grep + base directory name.

for mac:

for dir in */; do (cd $dir; git grep -n Gemfile| tr -s '\n' '\0'|xargs -0 -I {} printf "$(basename $(pwd))/{}\n") done
Enter fullscreen mode Exit fullscreen mode
(snip)
ruby-saddler-reporter-text/.gitignore:3:/Gemfile.lock
ruby-saddler-reporter-text/README.md:59:Add this line to your application's Gemfile:
ruby-saddler-reporter-text/bin/console:9:# (If you use this, don't forget to add pry to your Gemfile!)
ruby-saddler-reporter-text/example/Gemfile:1:# A sample Gemfile
ruby-text_to_checkstyle/.gitignore:3:/Gemfile.lock
ruby-text_to_checkstyle/README.md:47:Add this line to your application's Gemfile:
ruby-text_to_checkstyle/bin/console:9:# (If you use this, don't forget to add pry to your Gemfile!)
ruby-uri-ssh_git/.gitignore:3:/Gemfile.lock
ruby-uri-ssh_git/README.md:65:Add this line to your application's Gemfile:
ruby-uri-ssh_git/bin/console:9:# (If you use this, don't forget to add pry to your Gemfile!)
Enter fullscreen mode Exit fullscreen mode

Top comments (0)