From 7fa6ac9318990347d011d2a22318a2de5f5d9679 Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Fri, 24 Jan 2020 12:55:07 -0800 Subject: [PATCH] Update deepgrep from alias to function The latest version of macOS did not play well with the version of deepgrep that piped find to xargs. Replaced it with version to use exec feature of find. --- bash/aliases | 1 - bash/functions | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bash/aliases b/bash/aliases index 8106621..8eaefb1 100644 --- a/bash/aliases +++ b/bash/aliases @@ -55,7 +55,6 @@ alias can-haz='sudo apt-get install ' alias take='sudo chown $(whoami):$(whoami) ' alias simple-http-server='python3 -m http.server' alias numfiles='find . -maxdepth 1 -type f | wc -l' -alias deepgrep='find . -type d -name "node_modules" -prune -o -type f -not -name "*.swp" -not -name "*.pyc" | sed "s/$/\"/g" | sed "s/^/\"/g" | xargs grep --color ' alias slugify="sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z" # Show list of git branches diff --git a/bash/functions b/bash/functions index 5a9c889..6a1b8dc 100644 --- a/bash/functions +++ b/bash/functions @@ -28,3 +28,13 @@ function add-date-prefix { function get-bitrate { exiftool -AudioBitrate "$1" | awk '{print $4}' } + +function deepgrep { + find . \ + -type d -name node_modules -prune -o \ + -type d -name .git -prune -o \ + -type f \ + -not -name "*.swp" \ + -not -name "*.pyc" \ + -exec grep --with-filename --color "$@" {} \; +}