idlastro / Miscellaneous (Non-Astronomy) Procedures: HGREP

[Source code]

NAME
HGREP
PURPOSE
Find a substring in a FITS header (or any other string array)
CALLING SEQUENCE
HGREP, header, substring, [/KEEPCASE, /LINENUM ]
INPUTS
header -  FITS header or other string array
substring - scalar string to find in header; if a numeric value is 
          supplied, it will be converted to type string
OPTIONAL INPUT KEYWORDS
/KEEPCASE: if set, then look for an exact match of the input substring 
          Default is to ignore case .
/LINENUM: if set, prints line number of header in which
         substring appears 
OUTPUTS
None, results are printed to screen
EXAMPLE
Find every place in a FITS header that the word 'aperture'
appears in lower case letters and print the element number 
of the header array:
IDL> hgrep, header, 'aperture', /keepcase, /linenum
HISTORY
Written, Wayne Landsman (Raytheon ITSS)      August 1998
Adapted from STIS version by Phil Plait/ ACC November 14, 1997
Remove trailing spaces if a non-string is supplied W. Landsman Jun 2002