keyword_exists (version 1.0)

You can also look at:
#! /usr/bin/perl

##############################################################################
#
# SYNTAX: keyword_exists file keyword
#
# DESCRIPTION: This utility checks if a given FITS keyword value
# DESCRIPTION: is present in a file.
# DESCRIPTION: "yes" is printed to stdout if the keyword exists,
# DESCRIPTION: "no" is printed if it does not.
#
# VERSION: 1.0
#
# HISTORY: 0.0 -> 1.0 1999-05-07
# HISTORY: Converted from ksh to perl
#
# CALLS: $UTIL/setup_parfile
# CALLS: $UTIL/read_parfile
# CALLS: $UTIL/ftool_test
# CALLS: $FTOOL/fkeypar
#
##############################################################################

($file, $keyword) = @ARGV;

$UTIL = $ENV{"UTIL"};
$FTOOL = $ENV{"FTOOL"};

if ( ! "$file" ) {
    $file = "undefined";
    $keyword = "undefined";
}

`$UTIL/setup_parfile $FTOOL/fkeypar.par fitsfile="$file" keyword="$keyword"`;

`$FTOOL/fkeypar >stdout${$}.log 2>stderr${$}.log`;
$code = $?;

system("$UTIL/read_parfile ./fkeypar.par exist");

`$UTIL/ftool_test fkeypar $code $0 1 stdout${$}.log stderr${$}.log`;

exit 0;