File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
1010For a steady stream of TILs from a variety of rocketeers, checkout
1111[ til.hashrocket.com] ( https://til.hashrocket.com/ ) .
1212
13- _ 760 TILs and counting..._
13+ _ 761 TILs and counting..._
1414
1515---
1616
@@ -687,6 +687,7 @@ _760 TILs and counting..._
687687- [ File Type Info With File] ( unix/file-type-info-with-file.md )
688688- [ Find Newer Files] ( unix/find-newer-files.md )
689689- [ Forward Multiple Ports Over SSH] ( unix/forward-multiple-ports-over-ssh.md )
690+ - [ Get Matching Filenames As Output From Grep] ( unix/get-matching-filenames-as-output-from-grep.md )
690691- [ Get The Unix Timestamp] ( unix/get-the-unix-timestamp.md )
691692- [ Global Substitution On The Previous Command] ( unix/global-substitution-on-the-previous-command.md )
692693- [ Globbing For All Directories In Zsh] ( unix/globbing-for-all-directories-in-zsh.md )
Original file line number Diff line number Diff line change 1+ # Get Matching Filenames As Output From Grep
2+
3+ Standard use of the [ ` grep `
4+ command] ( http://man7.org/linux/man-pages/man1/grep.1.html ) outputs the lines
5+ that match the specified pattern. You can instead output just the names of
6+ the files where those matches occur. To do this, include the ` -l ` flag.
7+
8+ ``` bash
9+ $ grep -Rl hashrocket .
10+ ./elixir/run-exunit-tests-in-a-deterministic-order.md
11+ ./git/show-file-diffs-when-viewing-git-log.md
12+ ./git/single-key-presses-in-interactive-mode.md
13+ ./internet/enable-keyboard-shortcuts-in-gmail.md
14+ ...
15+ ```
16+
17+ This recursive grep finds all the files where ` hashrocket ` appears. It only
18+ looks for the first match in a file, so each file will only be listed once
19+ even if there may have been multiple matches.
20+
21+ See ` man grep ` for more details.
You can’t perform that action at this time.
0 commit comments