From f580c8ee9b872118efee666bd38ce9dce035578e Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Wed, 16 Nov 2016 14:59:10 -0600 Subject: [PATCH] Add Search Files Specific To A Language as a unix til --- README.md | 3 ++- unix/search-files-specific-to-a-language.md | 22 +++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 unix/search-files-specific-to-a-language.md diff --git a/README.md b/README.md index 2e93dc8..3764301 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ variety of languages and technologies. These are things that don't really warrant a full blog post. These are mostly things I learn by pairing with smart people at [Hashrocket](http://hashrocket.com/). -_484 TILs and counting..._ +_485 TILs and counting..._ --- @@ -444,6 +444,7 @@ _484 TILs and counting..._ - [PID Of The Current Shell](unix/pid-of-the-current-shell.md) - [Repeat Yourself](unix/repeat-yourself.md) - [Saying Yes](unix/saying-yes.md) +- [Search Files Specific To A Language](unix/search-files-specific-to-a-language.md) - [Search History](unix/search-history.md) - [Search Man Page Descriptions](unix/search-man-page-descriptions.md) - [Securely Remove Files](unix/securely-remove-files.md) diff --git a/unix/search-files-specific-to-a-language.md b/unix/search-files-specific-to-a-language.md new file mode 100644 index 0000000..aeb2a8c --- /dev/null +++ b/unix/search-files-specific-to-a-language.md @@ -0,0 +1,22 @@ +# Search Files Specific To A Language + +The `ack` command makes it easy to narrow the set of searched files to those +of a specific programming language. For instance, if you have a rails +project and only want to search the ruby files, use the `--ruby` flag with +your `ack` command. + +```bash +$ ack --ruby Active +``` + +With the `--ruby` flag, I get a manageable number of results. Without it, +not so much. + +```bash +$ ack --ruby Active | wc -l + 26 +$ ack Active | wc -l + 5253 +``` + +See `man ack` for more details.