I recently came across a nice simple way to access FITS header keywords at the command line via the “Stand-alone FITS tools” provided by ESO. The combination of
fitsort work like the IRAF
hselect routine, but they are run at the command line and therefore have access to all of the shell tools like
cd /tmp/ ### or anywhere else mkdir ESOFITS cd ESOFITS wget http://archive.eso.org/saft/dfits/dfits.c wget http://archive.eso.org/saft/fitsort/fitsort.c gcc -o dfits dfits.c gcc -o fitsort fitsort.c sudo cp dfits fitsort /usr/local/bin ### or somewhere else in your $PATH
Now you can run it with, e.g.,
dfits f140w.fits | fitsort NAXIS1 NAXIS2 EXPTIME FILE NAXIS1 NAXIS2 EXPTIME f140w.fits 7017 8361 4.058728020E+03
dfits also works with wildcards, e.g.
dfits ib*flt.fits | fitsort FILTER.