diff --git a/README.md b/README.md index 180c8ba..518364c 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186). -_1674 TILs and counting..._ +_1675 TILs and counting..._ See some of the other learning resources I work on: @@ -1605,6 +1605,7 @@ If you've learned something here, support my efforts writing daily TILs by - [Enable Multi-Select Of Results With fzf](unix/enable-multi-select-of-results-with-fzf.md) - [Exclude A Command From The ZSH History File](unix/exclude-a-command-from-the-zsh-history-file.md) - [Exclude A Directory With Find](unix/exclude-a-directory-with-find.md) +- [Exclude A Specific File From fd Results](unix/exclude-a-specific-file-from-fd-results.md) - [Exclude Certain Files From An rsync Run](unix/exclude-certain-files-from-an-rsync-run.md) - [Figure Out The Week Of The Year From The Terminal](unix/figure-out-the-week-of-the-year-from-the-terminal.md) - [File Type Info With File](unix/file-type-info-with-file.md) diff --git a/unix/exclude-a-specific-file-from-fd-results.md b/unix/exclude-a-specific-file-from-fd-results.md new file mode 100644 index 0000000..f28d6fb --- /dev/null +++ b/unix/exclude-a-specific-file-from-fd-results.md @@ -0,0 +1,26 @@ +# Exclude A Specific File From fd Results + +I recent wrote a +[`cat-to-markdown`](https://github.com/jbranchaud/dotfiles/blob/my-dotfiles/bin/cat-to-markdown) +script that can be piped a list of files from the output of another command to +do its thing. I then used [`fd`](https://github.com/sharkdp/fd) to list a +specific set of files by extension that could be piped to this command. + +```bash +fd -e js | cat-to-markdown | pbcopy +``` + +This worked, but I quickly realized that one of the JavaScript files included in +that listing was massive and didn't need to be included. + +To exclude it from the list I can use the `-E` flag and then name the file like +so: + +```bash +fd -e js -E super-large-file.js | cat-to-markdown | pbcopy +``` + +I believe this can be an exact match file path or even a pattern that matches +multiple files. + +See `man fd` for more details.