tool for grepping in bookmark files
authormirabilos <m@mirbsd.org>
Wed, 3 Oct 2018 19:08:21 +0000 (19:08 +0000)
committermirabilos <m@mirbsd.org>
Wed, 3 Oct 2018 19:08:21 +0000 (19:08 +0000)
mksh/bmgrep [new file with mode: 0644]

diff --git a/mksh/bmgrep b/mksh/bmgrep
new file mode 100644 (file)
index 0000000..9136302
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/mksh
+set -A args
+blub=0
+for x in "$@"; do
+       case $blub:$x {
+       (0:--)
+               blub=1
+               ;;
+       (0:-*)
+               args[${#args[*]}]=$x
+               ;;
+       (*)
+               args[${#args[*]}]=-e
+               args[${#args[*]}]=$x
+               ;;
+       }
+done
+wc -l ~/.etc/*.htm
+print -ru2 -- + fgrep "${args[@]}"
+exec fgrep -n "${args[@]}" -- ~/.etc/*.htm