source: util/grep_shielding.sh@ bd7b85

Last change on this file since bd7b85 was a0bcf1, checked in by Frederik Heber <heber@…>, 17 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
Line 
1#!/bin/sh
2#
3# greps and reformats shielding values from multiple logs
4
5ecuts="19 20 21 22 23 24 25 26 27"
6
7# check for given tag
8if [ -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
13else
14 tag=$1
15 rows=$2
16fi
17
18# grep the stuff
19array=(`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
22old_IFS=$IFS
23IFS='
24'
25
26# generate list for loop
27count=${#array[@]}
28echo total number of entries: $count
29let cols="$count / $rows"
30let current="$cols * $rows"
31echo -n "Comparing $current to $count: "
32if [ "$current" -lt "$count" ]; then
33 let cols=$cols+1
34 echo " increasing by one."
35else
36 echo "fine."
37fi
38echo "total number of columns and rows: ($cols, $rows)"
39
40# and finally print out in rearranged way
41j=0
42while [ "$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
53done
54
55
56IFS=$old_IFS
57exit 0
Note: See TracBrowser for help on using the repository browser.