#!/usr/bin/perl ############################################################################### # PERL script that extracts observed objects from 2QZ catalogue and # writes the results to a file named infile.extract # # Written By Scott Croom (05/06/03) # ################################################################################ # # # LICENCE # # # # This program is free software; you can redistribute it and/or # # modify it under the terms of the GNU General Public License # # as published by the Free Software Foundation; either version 2 # # of the License, or (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the Free Software # # Foundation, Inc., 59 Temple Place - Suite 330, # # Boston, MA 02111-1307, USA. # # # ################################################################################ # # Pragmas: use diagnostics; # # Modules use TWOQZ_CAT; # # Get command line info: if ( scalar(@ARGV) != 1 ) { print "Usage: extract.pl <2QZ_catalogue_file>\n"; exit; } $catfile = shift(@ARGV); # # define output file name: $outfile=$catfile.".extract"; # # Open input and output files: open ( CAT , $catfile ); open ( OUT , "> ".$outfile); # # Read catalogue file and write entry to output if the # number of observations > 0 (i.e. $nobs>0): $nlines=0; while ( $line = ) { chomp($line); rline($line); if ($nobs != 0) { print OUT "$line\n"; $nlines++; } } print"$nlines objects extracted\n"; close(CAT); close(OUT); ###############################################################################