#!/bin/ksh # Store minimum energy from each strain file skeng.strainsq in the file # c44.eng. # Usualy disclaimers apply. Don't bet your life on this script: # This software and any accompanying documentation are released "as # is." The U.S. Government makes no warranty of any kind, expressed # or implied, concerning this software and any accompanying # documentation, including without limitation, any warranties of # merchantability or fitness for a particular purpose. In no event # will the U.S. Government be liable for any damages, including any # lost profits, lost savings, or other incidental or consequential # damages arising out of the use, or inability of use, of this # software or any accompanying documentation, even if informed in # advance of the possibility of such damages. # # First, get rid of any previous c44.eng, and make sure a new one exists: rm -f c44.eng touch c44.eng # Now scroll through all the skeng files: for sqfile in skeng.* do # Label: strain=${sqfile#skeng.} # Note that GNU sort doesn't do this quite right. That is, "sort -n" # puts all the positive numbers first, then the negative numbers. # Both groups are properly ordered, but I'd hardly call this # "numerical order". I'll see if I can figure out a workaround. # Also note that the energy better be in the sixth column, else # you'll be minimizing who knows what. # Finally, we don't need the index from column 1 echo $strain `sort -k5 $sqfile | head -1 | awk '{print $2, $3, $4, $5, $6}'` >> c44.eng done