2. I have to run another perl script (grib2ctl.pl), is this how to do it
(marked blue in the code below).

 You use the system command for this as below,
system("perl grib2ctl.pl");

3. I have to delete the files ending in H. Is unlink <*H>; the way?
        first do the pattern matching like this,
        $file_delete =~ /H$/;
         and read the complete path like
        $file_delete = /home/zilore/$file_delete;
         system("rm $file_delete);

    Use for loop for the itteration to search all H files.


--
Regards,
Mustafa



________________________________

From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of zilore
mumba
Sent: Thursday, November 13, 2008 12:54 PM
To: [email protected]
Subject: How does one concatenate many files into one?


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;




Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to 
this message are intended for the exclusive use of the addressee(s) and may 
contain proprietary, confidential or privileged information. If you are not the 
intended recipient, you should not disseminate, distribute or copy this e-mail. 
Please notify the sender immediately and destroy all copies of this message and 
any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should 
check this email and any attachments for the presence of viruses. The company 
accepts no liability for any damage caused by any virus transmitted by this 
email. 

www.wipro.com
_______________________________________________
ActivePerl mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to