#!/usr/bin/perl # Routine to correct the syntax error in the NNSN FITS headers that list # "A'HEARN" in the submitter field, as identified in the "ahearn.sub" file. # We'll need to fix just the FITS headers for these files. Fortunately, # the corrected SUBMITTR line is identical in all cases. # # Format: % fixmasub $TMPFILE = "__bob.tmp"; # First, we'll set the corrected line: $newsub = sprintf "%-80.80s", "SUBMITTR= 'A''HEARN,M ' /submitter's name"; # Now we'll loop through the list of files to be corrected (this list has the # path information): open (LST,"ahearn.sub") || die "Could not open 'ahearn.lst' ($!)"; while ($file=) { chop $file; $filename = substr($file,12,8); # We'll start with the FITS file. We know the SUBMITTR line is the 16th # in the first FITS block. open (TMP,">$TMPFILE") || die "Could not open $TMPFILE ($!)"; open (FIT,$file) || die "Could not open $file ($!)"; read FIT,$block,2880; substr($block,1200,80) = $newsub; syswrite TMP,$block,2880; # Now just copy the rest of the file: while (!eof(FIT)) { read FIT, $block, 2880; syswrite TMP, $block, 2880; } close(FIT); close(TMP); rename $TMPFILE, $file; }