Now search in the link descriptions is possible. - gopher-lawn - The gopher law… | |
git clone git://bitreich.org/gopher-lawn/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhf… | |
Log | |
Files | |
Refs | |
Tags | |
--- | |
commit 58384352307d77576142fadc9b4493b299c3e489 | |
parent cc5c00a7617d4f9b57199acf97114767806566a5 | |
Author: Christoph Lohmann <[email protected]> | |
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(-) | |
--- | |
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… | |
- subdir="${sel##$STRIP}" | |
- [ -d "$subdir" ] && { | |
- grep -i "${X_GOPHER_SEARCH}" "$subdir/index.gph" | grep "^\[" … | |
- } | |
-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 se… | |
+# subdir="${sel##$STRIP}" | |
+# [ -d "$subdir" ] && { | |
+# grep -i "${X_GOPHER_SEARCH}" "$subdir/index.gph" | grep "^\["… | |
+# } | |
+#done | |