I have been successful in looping over all the files by grep grep "SCF Done" $files|awk "{print \\\$5}"`;. It has given the SCF Done from each file. Now I can search my self among the SCF Done list of 200 files that which one has lowest "SCF Done". I have fonud a file. But problem is that I want to use that file in next step. Each file has a column with electron delocalization papameter that a long column with number but column header is (EDu). I want to code for:
1. Find the file among 200 files which has lowest SCF Done. 2. Then I want to use the (EDu) column of this minimum SCF Done file from step 1 to get the difference of (EDu) of all remaining 199 files and want to get result in a text file. For example if (EDu) of minimum SCF Done file be (EDu)min. I want (EDu)min - (EDu)1, (EDu)min - (EDu)2, (EDu)min - (EDu)3.......... where 1, 2, 3..... represent the name of all files in the directory.
Here I am sending the code which is given by my Supervisor and I am required to finalize it. Please complete it if possible.
use strict;
my $SCFDoneLowSoFar = 0.0; # The lowest energy found so far
my $FileLowSoFar = ''; # The file containing the lowest energy so far
foreach my $files (<*log>){ # Loop over all of the files
my $E=`grep "SCF Done" $files|awk "{print \\\$5}"`; chomp($E);
+# Find the energy in this file
# Check if the energy in this file is LOWER than the lowest en
+ergy so far
# If it is, then it is the NEW lowest energy so far
# and the file containing is the new FileLowSoFar
print "File $files has energy $E and the lowest energy so far
+is $SCFDoneLowSoFar\n";
}
print "The lowest total energy was $ELowSoFar\n";
print "This was in file $FileLowSoFar\n";
I ahve been struggling for more tahn a week. |