dotfiles/.bin/OLD/psearch

30 lines
977 B
Plaintext
Raw Normal View History

#!/bin/sh
_term="$@"
_dir="/usr/ports"
find $_dir/* -mindepth 1 -maxdepth 1 -name "Makefile" \
| while read _cmakefile
do
echo $_cmakefile | sed "s|$_dir/\(.*\)/Makefile|\1|g" \
| while read _cat
do
cat $_dir/$_cat/Makefile \
| fgrep SUBDIR \
| cut -d"=" -f2 \
| while read _port
do
if [ -f "$_dir/$_cat/$_port/pkg/DESCR" ]
then
fgrep -q "$_term" $_dir/$_cat/$_port/pkg/DESCR
if [ $? -eq 0 ]
then
echo "Match in $_cat/$_port:"
cat $_dir/$_cat/$_port/pkg/DESCR
echo "--------------------------"
fi
fi
done
done
done