#!/bin/bash IMPORTED=$1 CUSTOM=$2 COMBINED=$3 if test "x$IMPORTED" = "x" || test "x$CUSTOM" = "x" || test "x$COMBINED" = "x"; then echo "Usage: $0 imported.indices.ubuntu custom.indices.in combined.indices" exit fi if test ! -f "$IMPORTED";then echo "$IMPORTED doesn't exist" exit fi if test ! -f "$CUSTOM";then echo "$CUSTOM doesn't exist" exit fi if test "$CUSTOM" = "$COMBINED";then echo "$CUSTOM is the same file as $COMBINED" exit fi TAB=`echo -e '\011'` LINE="" > $COMBINED while read PACKAGE PRIORITY SECTION MAINTAINER;do LINE=`grep -E "^$PACKAGE$TAB" $CUSTOM` if test "x$LINE" = "x";then echo "$PACKAGE$TAB$PRIORITY$TAB$SECTION$TAB$MAINTAINER" >> $COMBINED else echo "$LINE" >> $COMBINED echo "$PACKAGE : $LINE" fi done < $IMPORTED