defectstats

来自「CMVC是IBM和许多跨国公司的缺陷管理工具。这里给出了很多在Linux下用KS」· 代码 · 共 177 行

TXT
177
字号
#!/bin/ksh## SAMPLE NAME: defectStats## FUNCTIONS:   This sample shell script displays total active defect#              statistics on a defect owner area basis.## USAGE:       defectStats ownerArea## ENVIRONMENT# VARIABLE(S): CMVC_FAMILY [CMVC_BECOME]## ORIGINS:     27## 5765-039 (C) COPYRIGHT International Business Machines Corp. 1991,1993# 5765-207 (C) COPYRIGHT International Business Machines Corp. 1993# 5765-202 (C) COPYRIGHT International Business Machines Corp. 1993# 5622-063 (C) COPYRIGHT International Business Machines Corp. 1993# 5765-069 (C) COPYRIGHT International Business Machines Corp. 1991,1993# All Rights Reserved# Licensed Materials - Property of IBM## US Government Users Restricted Rights - Use, duplication or# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.###           NOTICE TO USERS OF THE SOURCE CODE EXAMPLES## INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THE SOURCE CODE# EXAMPLES, BOTH INDIVIDUALLY AND AS ONE OR MORE GROUPS, "AS IS" WITHOUT# WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT# LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A# PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE# OF THE SOURCE CODE EXAMPLES, BOTH INDIVIDUALLY AND AS ONE OR MORE GROUPS,# IS WITH YOU.  SHOULD ANY PART OF THE SOURCE CODE EXAMPLES PROVE# DEFECTIVE, YOU (AND NOT IBM OR AN AUTHORIZED RISC System/6000* WORKSTATION# DEALER) ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, REPAIR OR# CORRECTION.## * RISC System/6000 is a trademark of International Business Machines#   Corporation.## /usr/lpp/cmvc/samples/defectStats## *************************************************************************# Note: This file produces 132 column output and is easier to view and#       edit if displayed in 132 columns.# *************************************************************************#if [ $# -eq 0 ]then        echo "\nusage: $0 ownerArea\n"        echo "This sample shell script displays total active defect"        echo "statistics on a defect owner area basis."        exit 1fiif [ -z "$CMVC_FAMILY" ]then  echo "The CMVC family must be set with the CMVC_FAMILY environment variable."  exit 1fi# Clean up on interrupttrap 'echo "\n$0: Interrupted."; cleanup; exit 1' 2 3 15cleanup(){        rm -f /tmp/dstat$$ 2>/dev/null}Report -vi DefectView -w "state not in ('closed','canceled') and ownerArea= '$1'" \-raw | awk -F'|' '{print $3,$6,$8}' | sort >/tmp/dstat$$cat /tmp/dstat$$ | \awk '{    #    # When field one changes, output the "sum" line, unless this is the    # first record, since it is always different.    #    if ($1 != saveComp) {        if (NR == 1) {            printf "\n\n                        DEFECT STATISTICS FOR DEPARTMENT '$1'\n"            printf "\n              ---------------------------------------------------------"            printf "\n               (O) = Open  (W) = Working  (V) = Verify  (R) = Returned\n"            printf "              ---------------------------------------------------------\n"    printf "\n%32.32s %6.6s %5.5s %5.5s %5.5s %3.3s %3.3s %3.3s %3.3s %5.5s\n", "Component", "Sev 1", "Sev 2", "Sev 3", "Sev 4", "(O)", "(W)", "(V)", "(R)", "Total"            printf "%32.32s %6.6s %5.5s %5.5s %5.5s %3.3s %3.3s %3.3s %3.3s %5.5s\n", "---------------------------------", "-----", "-----", "-----", "-----", "---", "---", "---", "---", "-----"            #            #initialize the totals            #            allOpen = 0            allWork = 0            allVerify = 0            allReturn = 0            allSv1 = 0            allSv2 = 0            allSv3 = 0            allSv4 = 0            allTotal = 0            }        else            {            allTotal += total            printf "%32.32s %6.6s %5.5s %5.5s %5.5s %3.3s %3.3s %3.3s %3.3s %5.5s\n", saveComp, sv1, sv2, sv3, sv4, open, work, verify, returned, total            }        #        # Reset the save value and the "sum".        #        saveComp = $1        sv1      = 0        sv2      = 0        sv3      = 0        sv4      = 0        open     = 0        work     = 0        verify   = 0        returned = 0        total    = 0        }    #    # Accumulate the sum for every record.    #    total += 1    if ($2 == "open") {        open += 1        allOpen += 1        }    else if ($2 == "working") {        work += 1        allWork += 1        }    else if ($2 == "verify") {        verify += 1        allVerify += 1        }    else if ($2 == "returned") {        returned += 1        allReturn += 1        }    if ($3 == 1) {        sv1 += 1        allSv1 += 1        }    else if ($3 == 2) {        sv2 += 1        allSv2 += 1        }    else if ($3 == 3) {        sv3 += 1        allSv3 += 1        }    else if ($3 == 4) {        sv4 += 1        allSv4 += 1        }    }END {    #    # Output the last "sum" line after the last record was read.    #    printf "%32.32s %6.6s %5.5s %5.5s %5.5s %3.3s %3.3s %3.3s %3.3s %5.5s\n", saveComp, sv1, sv2, sv3, sv4, open, work, verify, returned, total    #    # Output the "all" totals    #    allTotal += total    if (allTotal != 0) {    printf "%32.32s %6.6s %5.5s %5.5s %5.5s %3.3s %3.3s %3.3s %3.3s %5.5s\n", "---------------------------------", "-----", "-----", "-----", "-----", "---", "---", "---", "---", "-----"    printf "%32.32s %6.6s %5.5s %5.5s %5.5s %3.3s %3.3s %3.3s %3.3s %5.5s\n", "TOTAL", allSv1, allSv2, allSv3, allSv4, allOpen, allWork, allVerify, allReturn, allTotal    }    }'rm /tmp/dstat$$

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?