#!/usr/bin/python
import sys
import pyfits
import re
for file in sys.argv[1:]: #exclude the first element of sys.argv
hdulist = pyfits.open(file) #open fits
key = hdulist[1].header['OBJECT'] #reads a keyword from the fits header
if (re.search('standard',key)): #search the keyword value for some string
print file
To execute just run on the command line:
# python script.py file1 file2 ...
or
# chmod +x script.py
# ./script.py file1 file2 ...
All bash's wildcards (*, ?, etc) are accepted.
No comments:
Post a Comment