| 
            Last change
 on this file since 417bb5 was             a0bcf1, checked in by Frederik Heber <heber@…>, 18 years ago           | 
        
        
          | 
             
-initial commit 
-Minimum set of files needed from ESPACK SVN repository 
-Switch to three tantamount package parts instead of all relating to pcp (as at some time Ralf's might find inclusion as well) 
 
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100755
               
             
           | 
        
        
          | 
            File size:
            1.3 KB
           | 
        
      
      
| Rev | Line |   | 
|---|
| [a0bcf1] | 1 | #!/bin/sh
 | 
|---|
 | 2 | #
 | 
|---|
 | 3 | # greps and reformats shielding values from multiple logs
 | 
|---|
 | 4 | 
 | 
|---|
 | 5 | ecuts="19 20 21 22 23 24 25 26 27"
 | 
|---|
 | 6 | 
 | 
|---|
 | 7 | # check for given tag
 | 
|---|
 | 8 | if [ -z "$2" ]; then
 | 
|---|
 | 9 |         echo "Usage: $0 <tag> <#row>"
 | 
|---|
 | 10 |         echo "  <tag> gives the prefix of the logs up to the cut values, e.g. tms_tm_1-25_25Ht.1.e127 then tag is \"tms_tm_1-25\""
 | 
|---|
 | 11 |         echo "  <#row> gives the number of rows on the final output"
 | 
|---|
 | 12 |         exit 1
 | 
|---|
 | 13 | else
 | 
|---|
 | 14 |         tag=$1
 | 
|---|
 | 15 |         rows=$2
 | 
|---|
 | 16 | fi
 | 
|---|
 | 17 | 
 | 
|---|
 | 18 | # grep the stuff
 | 
|---|
 | 19 | array=(`for i in $ecuts; do echo ${i}; grep shielding\ \ : ${tag}_${i}Ht*e* | awk -F": " {'print $2'} | tr . ,; done`)
 | 
|---|
 | 20 | 
 | 
|---|
 | 21 | # now do the fancy stuff with the field delimiters, to reinterpret the array as a list of lines
 | 
|---|
 | 22 | old_IFS=$IFS
 | 
|---|
 | 23 | IFS='
 | 
|---|
 | 24 | '
 | 
|---|
 | 25 | 
 | 
|---|
 | 26 | # generate list for loop
 | 
|---|
 | 27 | count=${#array[@]}
 | 
|---|
 | 28 | echo total number of entries: $count
 | 
|---|
 | 29 | let cols="$count / $rows"
 | 
|---|
 | 30 | let current="$cols * $rows"
 | 
|---|
 | 31 | echo -n "Comparing $current to $count: "
 | 
|---|
 | 32 | if [ "$current" -lt "$count" ]; then
 | 
|---|
 | 33 |         let cols=$cols+1
 | 
|---|
 | 34 |         echo " increasing by one."
 | 
|---|
 | 35 | else
 | 
|---|
 | 36 |         echo "fine."
 | 
|---|
 | 37 | fi
 | 
|---|
 | 38 | echo "total number of columns and rows: ($cols, $rows)"
 | 
|---|
 | 39 | 
 | 
|---|
 | 40 | # and finally print out in rearranged way
 | 
|---|
 | 41 | j=0
 | 
|---|
 | 42 | while [ "$j" -lt "$rows" ]; do
 | 
|---|
 | 43 |         i=0
 | 
|---|
 | 44 |         while [ "$i" -lt "$cols" ]; do
 | 
|---|
 | 45 |                 let current="$i * $rows + $j"
 | 
|---|
 | 46 |                 if [ "$current" -lt "$count" ]; then
 | 
|---|
 | 47 |                         echo -e -n "${array[$current]}\t"
 | 
|---|
 | 48 |                 fi
 | 
|---|
 | 49 |                 let i=$i+1
 | 
|---|
 | 50 |         done
 | 
|---|
 | 51 |         echo -e -n "\n"
 | 
|---|
 | 52 |         let j=$j+1
 | 
|---|
 | 53 | done
 | 
|---|
 | 54 | 
 | 
|---|
 | 55 | 
 | 
|---|
 | 56 | IFS=$old_IFS
 | 
|---|
 | 57 | exit 0
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.