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.


In reply to Re^2: Making commond for large number of files by acrobat118
in thread Making commond for large number of files by acrobat118

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.