The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




Thread: Help Required
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 11-23-2008
wakhan wakhan is offline
Registered User
  
 

Join Date: Apr 2008
Posts: 58
Help Required

Below is my code which gives output like this: Every time we have to open the script file and change the value of TG in BEGIN. what i want to do is
that i give two three values at the sametime and then run the script and
it gives output one by one at the same time.

I think i have to define some array in which those values are defined and then
it gives those values to variable TG one by one.

Please help... if you can provide some help for coding

HTML Code:
KarachiOMP root> ./tgcmp702
DATE IN ST EN  TGN ISEIZE ISATMP   IANS OATMPT   OVFL OSEIZE OSATMP   OANS TOTUSG OOSMTCE   OOS DBLSZR NTWCONG
1121 24 23 24  606   7462   7459   3573      0      0      0      0      0  55694      0      0      0      0
1122  1  0  1  606   6593   6592   2879      0      0      0      0      0  55330      0      0      0      0
1122  2  1  2  606   4000   4000   1724      0      0      0      0      0  42891      0      0      0      0
1122  3  2  3  606    542    541    248      0      0      0      0      0  11908      0      0      0      0
1122  4  3  4  606      0      0      0      0      0      0      0      0    119      0      0      0      0
1122  5  4  5  606      0      0      0      0      0      0      0      0      0      0      0      0      0
1122  6  5  6  606      0      0      0      0      0      0      0      0      0      0      0      0      0
1122  7  6  7  606      0      0      0      0      0      0      0      0      0      0      0      0      0
1122  8  7  8  606      0      0      0      0      0      0      0      0      0      0      0      0      0
1122  9  8  9  606      0      0      0      0      0      0      0      0      0      0      0      0      0
1122 10  9 10  606      0      0      0      0      0      0      0      0      0      0      0      0      0
1122 11 10 11  606   1259   1257    645      0      0      0      0      0   3886      0      0      0      0
1122 12 11 12  606   6257   6243   3186      0      0      0      0      0  23033      0      0      0      0
1122 13 12 13  606   9770   9752   4980      0      0      0      0      0  38055      0      0      0      0
1122 14 13 14  606  11702  11685   5891      0      0      0      0      0  51436      0      0      0      0
1122 15 14 15  606  11609  11583   5803      0      0      0      0      0  48050      0      0      0      0
1122 16 15 16  606  11106  11075   5697      0      0      0      0      0  50772      0      0      0      0
1122 17 16 17  606   9674   9646   4808      0      0      0      0      0  41480      0      0      0      0
1122 18 17 18  606   8177   8169   4223      0      0      0      0      0  37136      0      0      0      0
1122 19 18 19  606  11609  11587   5922      0      0      0      0      0  49780      0      0      0      0
1122 20 19 20  606  11724  11722   5723      0      0      0      0      0  54494      0      0      0      0
1122 21 20 21  606  11981  11965   5722      0      0      0      0      0  53925      0      0      0      0
1122 22 21 22  606  11673  11667   5336      0      0      0      0      0  55016      0      0      0      0
1122 23 22 23  606  10351  10333   4747      0      0      0      0      0  55177      0      0      0      0

Code:
KarachiOMP root> vi tgcmp702

cat /omp-data/logs/5etr/081123.APX | nawk '

BEGIN {
TG=606;
        
printf ("DATE IN ST EN  TGN ISEIZE ISATMP   IANS OATMPT   OVFL OSEIZE OSATMP  OANS TOTUSG OOSMTCE   OOS DBLSZR
NTWCONG\n");
}

/TRFTR TGCOMP/ {
        getline; getline;
        split($2,a,"-");
        date=a[2]a[3];
        getline; getline; getline;
        interval=$2; split($3,a,":"); start=a[1]; split($4,a,":"); end=a[1];
}

/TGN    ISEIZE/ {
        getline;
        tgn=$1; iseize=$2; isattmp=$5; ians=$6;
}

/TGN    OATTMPT/ {
        getline;
        oattmpt=$2; ovfl=$4; oseize=$5; osattmp=$7;
}

/TGN    OANS/   {

        getline;

        oans=$2; totusg=$3;

}


/TGN    BWOUTU/ {

        getline;

        oosmtce=$4;

        oos=$5;

}


/TGN    DBLSZR/ {

        getline;

        dblszr=$2;

}


/TGN    SBBSY/  {

        getline;

        ntwcong=$4;

}


/TGN    TRKNAV/ {

        if (tgn==TG) {

printf("%s %2d %2d %2d %4d %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d %6d\n", date, interval, start, end, tgn, iseize, isattmp, ians, oattmpt, ovfl, oseize, osattmp, oans, totusg, oosmtce, oos, dblszr, ntwcong);

        }

}

END {

}


Last edited by wakhan; 11-23-2008 at 05:07 AM..