From bc3a1f13fd5fddb9fa8f3ecff6144b512ed9d08b Mon Sep 17 00:00:00 2001 From: KatolaZ Date: Wed, 8 Jan 2020 07:45:14 +0000 Subject: initial commit --- search_repo | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 search_repo (limited to 'search_repo') diff --git a/search_repo b/search_repo new file mode 100755 index 0000000..65dd9c5 --- /dev/null +++ b/search_repo @@ -0,0 +1,24 @@ +#!/bin/sh + +# +# Search a set of repos for specific words and return a list of URLS +# to the matching repos +# + +if [ $# -lt 2 ]; then + printf "Usage: %s [...]\n" $0 + exit 1 +fi + +FOLDER="$1" +shift +WORDS="$@" + +query=$(echo "$WORDS" | sed -E 's/\ /\|/g') + +cd "$FOLDER" + +res=$(grep -Eric "$query" | grep -v ":0$" | sort -t ':' -rnk2 | \ + sed -E 's/([a-z]+)\//\1:\/\//1;s/\/[^\/]*$//' ) + +echo "$res" | grep -Ei "^[a-z]+://" -- cgit v1.2.3