#!/bin/bash

apt-cache search ^$1* | cut -d' ' -f1 | grep -v "^$2\$" | tee filtered.txt