#!/usr/bin/perl -w

$file=$ARGV[0];
$file1=$ARGV[1];

chomp($time=`grep "scan1 peak time:" $file | awk ' { print \$5,\$6  } ' `); 
chomp($freq=`grep "frequeny" $file | awk ' { print \$5  } ' `); 
chomp($axis=`grep "axis" $file | awk ' { print \$4  } ' `); 
$freq=sprintf("%04d",$freq);

#backlash_18May2017_1043_EL_1371MHz.txt
chomp($time=`date -d\"$time\" \"+%d%b%Y_%H%M\"`);
printf("$time $freq $axis\n");

$nfile=join('',"backlash_",$time,"_",$axis,"_",$freq,"MHz.txt");
$nfile1=join('',"backlash_",$time,"_",$axis,"_",$freq,"MHz.pdf");

printf("$nfile\n");
printf("$nfile1\n");
system("mv $file  $nfile");
system("mv $file1  $nfile1");
