#!/bin/csh

if ( $1 == '' ) then
    echo Give as argument the name of a file with DOM-IDs you want to get the corresponding names and MBIDs for
echo The input file should be a column of DOM-IDs
echo The output are three columns with name, MB-IDs and DOM-IDs
    exit
endif

echo "use fat;" > /tmp/getnames.sql

foreach dom (`cat $1`)
    echo "select thename,mbid,thedomid,hv1 from domtune where thedomid="\"$dom\"";">> /tmp/getnames.sql
end

mysql -u penguin < /tmp/getnames.sql | grep -v mbid|column -t | sort -k 3
echo "----------------------------------------------"
echo name,      mbid  and domid, ordered after domid


