Esteemed Perl users, I have a perl script below which is meant to perform a couple of tasks, viz., combine several files into one (marked blue in the code below). I have looked, without success, for the command which does this. 1. Help how do I do this (all files end in H)? 2. I have to run another perl script (grib2ctl.pl), is this how to do it (marked blue in the code below). 3. I have to delete the files ending in H. Is unlink <*H>; the way? Assistance will be appreciated. Zilore # #!/usr/bin/perl -w #This script processes UKMO model data from RETIM-SYNERGIE and archives it on #the ACMAD system. The cycles (or times) are 00 and 12. # use strict; use warnings; use POSIX; use File::Path; use File::Copy; # my $ctl_ext=".ctl"; my $grib_ext=".grib"; # my $UK_sufx="2"; my $dash="-"; my $model="ukmo"; my @now = localtime; # my $dat = strftime "%Y%m%d", @now; my $dat1 = $dat + 1; my $hr = strftime "%H", @now; my $cycle = '00'; $cycle = '12' if $hr > 15; # my $model_mon=`date "+%m"`; my $mon_name=`date "+%B"`; my $yr=`date "+%y"`; # my $base_dir="/home/Mumba/archive/$model_mon$dash$mon_name$yr"; # chdir $base_dir/$model/$dat; my @files =ls; foreach my $file (@files) { *H "." $file > $model$cycle$grib_ext; #cat *H > $model$cycle$grib_ext; /usr/local/bin/grib2ctl.pl -verf $model$cycle$grib_ext > $model$cycle$ctl_ext; /usr/local/grads/bin/gribmap -i $model$cycle$ctl_ext -v -e; unlink <*H>; # rename("$base_dir/$model/$dat1/*H","$base_dir/$model/$dat"); my @files =ls; foreach my $file (@files) { *H "." $file > $model$cycle$grib_ext; #cat *H > $model$cycle$UK_sufx$grib_ext; /usr/local/bin/grib2ctl.pl -verf $model$cycle$UK_sufx$grib_ext > $model$cycle$UK_sufx$ctl_ext; /usr/local/grads/bin/gribmap -i $model$cycle$UK_sufx$ctl_ext -v -e; unlink <*H>; # # date; exit 0;
_______________________________________________ ActivePerl mailing list ActivePerl@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs