Now search in the link descriptions is possible. - gopher-lawn - The gopher lawn gopher directory project.
HTML git clone git://bitreich.org/gopher-lawn/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/gopher-lawn/
DIR Log
DIR Files
DIR Refs
DIR Tags
---
DIR commit 58384352307d77576142fadc9b4493b299c3e489
DIR parent cc5c00a7617d4f9b57199acf97114767806566a5
HTML Author: Christoph Lohmann <20h@r-36.net>
Date: Sun, 10 May 2020 18:35:52 +0200
Now search in the link descriptions is possible.
Thanks haydenh for the patch!
Diffstat:
M search.sh | 36 +++++++++++++++++++++-----------
1 file changed, 24 insertions(+), 12 deletions(-)
---
DIR diff --git a/search.sh b/search.sh
@@ -1,6 +1,5 @@
#!/bin/sh
-# Adapted from: gopher://kalos.mine.nu/0/software/search_lawn.dcgi
if [ $# -lt 1 ];
then
@@ -8,17 +7,30 @@ then
exit 1
fi
-IDX="index.gph"
-STRIP="/lawn/"
-
X_GOPHER_SEARCH="$1"
-IFS='
-'
-grep "^\[.*|/lawn.*|server|port]" ${IDX} | cut -d "|" -f 3 | while read -r sel; do
- subdir="${sel##$STRIP}"
- [ -d "$subdir" ] && {
- grep -i "${X_GOPHER_SEARCH}" "$subdir/index.gph" | grep "^\[" | grep -v "server\|port"
- }
-done
+for d in $(find . -type d | sed '/^\.\/\.git/d')
+do
+ tr '\n' '\t' < $d/index.gph \
+ | sed 's/\t\t/\n/g' \
+ | grep '^\['
+done \
+| grep -v '^\[1|<< back|/lawn|server|port\]$' \
+| grep "${X_GOPHER_SEARCH}" \
+| sed 's~^\[~\n&~' \
+| tr '\t' '\n'
+
+# Old: Thanks KatolaZ!
+# Adapted from: gopher://kalos.mine.nu/0/software/search_lawn.dcgi
+#IDX="index.gph"
+#STRIP="/lawn/"
+#
+#IFS='
+#'
+#grep "^\[.*|/lawn.*|server|port]" ${IDX} | cut -d "|" -f 3 | while read -r sel; do
+# subdir="${sel##$STRIP}"
+# [ -d "$subdir" ] && {
+# grep -i "${X_GOPHER_SEARCH}" "$subdir/index.gph" | grep "^\[" | grep -v "server\|port"
+# }
+#done