Skip to content

Commit 3e4188b

Browse files
committed
Add Get Matching Filenames As Output From Grep as a unix til
1 parent d3a5b99 commit 3e4188b

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
1010
For 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)
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
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.

0 commit comments

Comments
 (0)