# Usage: cat_swepam_files.pl
#
# Concatenates all files in the current directory with ``1m.txt'' in
# filename after removing the headers.  Output file is
# all_data_1m.dat.  Note that file is not sorted with respect to time.
#
#  R.S. Weigel 04/07/2004.

$dirname = './';

opendir(DIR, $dirname) or die "can't opendir $dirname: $!";
open(OUTFILE,">all_data_1m.dat");

while (defined($file = readdir(DIR))) {
    if ($file =~ /swepam_1m\.txt/) {
	open(INFILE,"$file");
	while ($line = <INFILE>) {
	    if ($line !~ m/\#|[A-Z]/){
		printf(OUTFILE "%s", $line);
		#print "$line";
	    }
	}
	close(INFILE);
    }
}

close(OUTFILE);


