/[CCFs]/bin/mtovccf
ViewVC logotype

Annotation of /bin/mtovccf

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Tue Mar 10 15:21:00 2015 UTC (9 years, 8 months ago) by ccflib
Branch: MAIN
Changes since 1.1: +35 -5 lines
Added date to Table. Added computation of real number and sequential number of issues to be able to compute the total number of CCFs

1 ccflib 1.1 #! /bin/bash
2    
3     # mtovccf (make tableof valid ccfs)
4     #
5     # Make a table of classes and issues type "Pipeline Release Notes"
6     # Requires that mlovccf has been run before to produce the all_ccfs.txt file
7     #
8 ccflib 1.2 # $Id: mtovccf,v 1.1 2015/03/10 13:28:13 ccflib Exp $
9 ccflib 1.1
10     VALID_CCF="/home/ccflib/valid_ccf"
11    
12     if [ ! -f "${VALID_CCF}/all_ccfs.txt" ] ; then
13     echo "Error: Please run first mlovccf"
14     exit
15     fi
16    
17     # Lists all CCF classes
18    
19     ccf_classes="${VALID_CCF}/ccf_classes.txt"
20    
21     while read line
22     do
23     class=`echo $line | awk -F"_" '{print $1"_"$2}'`
24     echo $class >> ${ccf_classes}
25     done < ${VALID_CCF}/all_ccfs.txt
26    
27     cat ${ccf_classes} | sort -u > ${VALID_CCF}/kk.txt
28     mv ${VALID_CCF}/kk.txt ${ccf_classes}
29    
30     # Output final file is named all_ccfs_table.txt
31    
32 ccflib 1.2 total_number_of_ccfs=0
33    
34 ccflib 1.1 all_ccfs_table="${VALID_CCF}/all_ccfs_table.txt"
35    
36     [ -f "${all_ccfs_table}" ] && rm ${all_ccfs_table}
37    
38 ccflib 1.2 now=`date +'%Y-%M-%dT%H:%M:%S'`
39    
40     echo "Table of valid CCFs at $now" >> ${all_ccfs_table}
41     echo >> ${all_ccfs_table}
42 ccflib 1.1 echo "|================================|=============|" >> ${all_ccfs_table}
43     echo "| Calibration File | Issue range |" >> ${all_ccfs_table}
44     echo "|================================|=============|" >> ${all_ccfs_table}
45    
46 ccflib 1.2
47 ccflib 1.1 while read ccf_class
48 ccflib 1.2 do
49     echo -n "Processing class $ccf_class ..."
50 ccflib 1.1 issues_file="${VALID_CCF}/ccf_issues_for_${ccf_class}.txt"
51     [ -f "${issues_file}" ] && rm ${issues_file}
52     while read line
53     do
54     class=`echo $line | awk -F"_" '{print $1"_"$2}'`
55     [ "$class" != "$ccf_class" ] && continue
56     issue=`echo $line | awk -F"_" '{print $3}' | cut -d. -f1`
57     echo $issue >> ${issues_file}
58     done < ${VALID_CCF}/all_ccfs.txt
59    
60 ccflib 1.2
61 ccflib 1.1 cat ${issues_file} | sort -u > kk.txt
62     mv kk.txt ${issues_file}
63 ccflib 1.2 real_number_of_issues_for_this_class=`wc -l ${issues_file} | awk -F" " '{print $1}'`
64 ccflib 1.1
65     first_issue=`head -1 ${issues_file}`
66     last_issue=`tail -1 ${issues_file}`
67    
68 ccflib 1.2 li=$((10#$last_issue))
69     fi=$((10#$first_issue))
70    
71     sequential_number_of_issues_for_this_class=$(($li - $fi + 1))
72     if [ "${real_number_of_issues_for_this_class}" -lt "${sequential_number_of_issues_for_this_class}" ] ; then
73     asterisk="(*)"
74     else
75     asterisk=" "
76     fi
77     total_number_of_ccfs=$(($real_number_of_issues_for_this_class + $total_number_of_ccfs))
78    
79 ccflib 1.1 if [ "${first_issue}" != "${last_issue}" ] ; then
80 ccflib 1.2 printf "| %-30s | %4s-%4s%3s|\n" ${ccf_class} ${first_issue} ${last_issue} ${asterisk} >> ${all_ccfs_table}
81 ccflib 1.1 else
82 ccflib 1.2 printf "| %-30s | %4s |\n" ${ccf_class} ${first_issue} >> ${all_ccfs_table}
83 ccflib 1.1 fi
84    
85 ccflib 1.2 echo "done"
86 ccflib 1.1 done < ${ccf_classes}
87    
88 ccflib 1.2 echo "|================================|=============|" >> ${all_ccfs_table}
89     echo >> ${all_ccfs_table}
90     echo "(*): Some issues in the range are not required." >> ${all_ccfs_table}
91     rm ${VALID_CCF}/ccf_classes.txt
92     rm ${VALID_CCF}/ccf_issues_for*.txt
93    
94    
95    
96     echo ; echo "Number of valid CCFs required at $now : ${total_number_of_ccfs}"

  ViewVC Help
Powered by ViewVC 1.1.27