From 7873536b92934e85628e6fc99d8663f8887cd967 Mon Sep 17 00:00:00 2001 From: dmarakom6 Date: Wed, 23 Jun 2021 19:36:22 +0300 Subject: [PATCH] notegrep: "sf" parameter --- util/notegrep.sh | 5 +++++ util/notegrep/sf.sh | 14 ++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 util/notegrep/sf.sh diff --git a/util/notegrep.sh b/util/notegrep.sh index f0f913f..505c337 100644 --- a/util/notegrep.sh +++ b/util/notegrep.sh @@ -164,6 +164,11 @@ function notegrep() { export option=$1 . ~/.shellnotes/util/notegrep/cf.sh ;; + -sf | --show-files ) + export regex=$2 + export option=$1 + . ~/.shellnotes/util/notegrep/sf.sh + ;; esac return 0 diff --git a/util/notegrep/sf.sh b/util/notegrep/sf.sh new file mode 100644 index 0000000..f80010c --- /dev/null +++ b/util/notegrep/sf.sh @@ -0,0 +1,14 @@ +:<<'info' +shellnotes - sf.sh +(C) Dimitris Marakomihelakis +Released under the "All rights reserved" category. See the RIGHTS.txt file +in /docs/github/ for its full text. +info + +files="$(grep -rwl $regex $DEFAULT_PATH/* | wc -l)" + +if [ $files -ge 1 ]; then + grep -rwl $regex $DEFAULT_PATH/* +else + echo "No matching files found." +fi \ No newline at end of file