shellnotes/util/notegrep/cl.sh

30 lines
642 B
Bash
Raw Normal View History

2021-06-23 17:20:07 +02:00
:<<'info'
shellnotes - cl.sh
(C) Dimitris Marakomihelakis
Released under the "All rights reserved" category. See the RIGHTS.txt file
in /docs/github/ for its full text.
info
2021-06-28 12:49:55 +02:00
if [ -f $DEFAULT_PATH/$notename ]; then
2021-06-29 08:06:57 +02:00
out="$(grep -c $regex $DEFAULT_PATH/$notename)"
2021-06-28 12:49:55 +02:00
if [ $out -eq 1 ]; then
echo "Compressed $out line of grep output."
elif [ $out -gt 1 ]; then
echo "Compressed $out lines of grep output."
echo -n "Show lines?(Y/N): " && read show
case $show in
yes | y | Y | YES | Yes )
grep -n $regex $DEFAULT_PATH/$notename
;;
esac
else
echo "No matching lines found."
fi
2021-06-23 18:27:44 +02:00
else
2021-06-28 12:49:55 +02:00
echo "No such file."
return 0
fi