This is an extremely useful task from Doug Mink's wcstools package. Below are some simple examples. Note that the "-u" will insure that something is printed to standard out (i.e. "___") even if a non-present keyword is requested.
% gethead Rsco5368.fits OBJECT N6951 % gethead -u aa aa GETHEAD: no files specified This message appears when the image file does NOT exist. % ls out.hccs phaseI_begin.sh* README Rsco5368.fits % gethead Rsco5368.fits dd Nothing appears with a BOGUS keyword % gethead -u /home/sco/sco/Red_PhaseI_Data/jun_2007_p1/RREU2100.fits OBJECT SA112 We can use a fullpath name for the image file. % gethead -u /home/sco/sco/Red_PhaseI_Data/jun_2007_p1/RREU2100.fits OBJ ___ We at least get a "___" for a BOGUS keyword if the "-u" flag is used. % gethead -u /home/sco/sco/Red_PhaseI_Data/jun_2007_p1/RREU2100.fits OBJ >>aaa % cat aaa ___
A fairly common thing I would want to do is find a list of images, and then determine what targets (objects) were in those images. HERE IS AN EXAMPLE.
A way to get a unique list, without a lot of manual editing IS IN THE EXAMPLE HERE.