Fix search. - gopher-lawn - The gopher lawn gopher directory project. | |
git clone git://bitreich.org/gopher-lawn/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhf… | |
Log | |
Files | |
Refs | |
Tags | |
--- | |
commit 33ab3e8d0d60e3457c3878ac97b5c4ad6ce10b74 | |
parent aa11f2c7f0c3d92013b95196aaf9be48ab267a50 | |
Author: Christoph Lohmann <[email protected]> | |
Date: Fri, 28 Aug 2020 13:21:31 +0200 | |
Fix search. | |
Diffstat: | |
M search.sh | 16 +++++++++------- | |
1 file changed, 9 insertions(+), 7 deletions(-) | |
--- | |
diff --git a/search.sh b/search.sh | |
@@ -1,5 +1,7 @@ | |
#!/bin/sh | |
- | |
+# | |
+# TODO: Add real search based on new db layout. | |
+# | |
if [ $# -lt 1 ]; | |
then | |
@@ -9,14 +11,14 @@ fi | |
X_GOPHER_SEARCH="$1" | |
-for d in $(find . -type d | sed '/^\.\/\.git/d') | |
-do | |
- tr '\n' '\t' < $d/index.gph \ | |
- | sed 's/\t\t/\n/g' \ | |
- | grep '^\[' | |
-done \ | |
+cat c/*.gph \ | |
+| tr '\n' '\t' \ | |
+| sed 's,\t\t,\n,g' \ | |
+| grep '^\[' \ | |
| grep -v '^\[1|<< back|/lawn|server|port\]$' \ | |
| grep -i "${X_GOPHER_SEARCH}" \ | |
+| sort \ | |
+| uniq \ | |
| sed 's~^\[~\n&~' \ | |
| tr '\t' '\n' | |