Created
October 1, 2025 03:53
-
-
Save thingsiplay/bd61301541151769ea18fb5e0de84504 to your computer and use it in GitHub Desktop.
Grep output with tree format (Bash function)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Bash function | |
| # | |
| # usage: treegrep GREPOPTIONS "pattern" | |
| treegrep() { | |
| # grep: | |
| # --recursive like --directories=recurse | |
| # --files-with-match print only names of FILEs with selected lines | |
| # tree: | |
| # --fromfile Reads paths from files (.=stdin) | |
| # -F Appends '/', '=', '*', '@', '|' or '>' as per ls -F. | |
| grep --recursive --files-with-match "${@}" | | |
| tree --fromfile -F | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment