#!/bin/sh # # Trims a specified full INDEX down to just the lines for the packages # in a given subdirectory. If packages are not found in the INDEX, we # ignore them. usage() { echo `basename $0` " " exit 1 } regex="^(" first=1 for file in `ls $2/*.tgz`; do pkgname=`basename $file | sed -e 's/\.tgz$//' -e 's/\./\\\./g` if [ $first -eq 1 ]; then first=0 else regex="${regex}|" fi regex="${regex}${pkgname}" done regex="${regex})" egrep "${regex}" $1