set -x
# pass in archive filename as arg 1.
FILEIN=$1

# get callsigns from ship callsign/name file.

cut -c 1-8 $STNhrly/anchorage_callsigns > anc_call
cut -c 1-8 $STNhrly/kodiak_callsigns > kod_call
cut -c 1-8 $STNhrly/valdez_callsigns > val_call
cut -c 1-8 $STNhrly/noaa_callsigns > noaa_call

# grep for all callsigns within each of the 3 new files.

for ship in `cat anc_call`
do
  grep $ship $FILEIN >> anchorage.out
done

for ship in `cat kod_call`
do
  grep $ship $FILEIN >> kodiak.out
done

for ship in `cat val_call`
do
  grep $ship $FILEIN >> valdez.out
done

for ship in `cat noaa_call`
do
  grep $ship $FILEIN >> noaa.out
done
exit
