#!/usr/bin/perl # Routine to collect and trim the IR filter tables # Loop through the headers: foreach $file (@ARGV) { next if ($file !~ /\.hdr/); open (HDR,$file) || die "could not open $file for reading ($!)"; read HDR,$line,2880; read HDR,$line,320; read HDR,$line,80; $line =~ /^NAXIS2\s+=\s+([0-9]+)\s/; $rows = $1; close(HDR); $filename = $file; $filename =~ s/\.hdr//; $newtab = "$filename.tab"; open (FIT,$newtab) || die "Could not open $newtab for reading ($!)"; open (NEW,"> new/$newtab") || die "Could not open new/$newtab for writing ($!)"; for ($i=0; $i<$rows; $i++) { read FIT,$line,80; printf NEW "$line\n"; } close(FIT); close(NEW); }