|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
script for taking the stats from a file
i have file which contains data like this every day.i need to pull up a report for counting the 203's in that file for each subscriber id.there are around 200 subscriber id's. all ths Y's which i have written in the script are the subscriber id's.could some one give me an idea as to how do it in a better way.
more 09031000010202.TL 203,0903100000042C,710,29,3, 207,0903100000042C,670,133,1 207,0903100000042C,26,9,7,09 207,0903100000042C,42,61,1,0 207,0903100000052C,710,29,7, 207,0903100000052C,50,7,7,09 207,0903100000052C,218,22,1, 207,0903100000052C,36,25,7,0 203,0903100000052C,720,24,3, 203,0903100000052C,36,79,3,0 Script: #!/bin/sh set -x thisday =`date +%y%m%d00010202.TLG` for Y in 2 144 9 129 16 37 42 45 87 104 53 40 62 63 51 158 18 19 20 21 50 67 82 116 64 100 141 168 170 171 49 84 85 35 34 70 61 69 8 26 27 28 78 79 32 33 10 11 130 25 36 47 57 200 173 6 46 48 55 56 72 118 22 13 110 109 203 29 80 12 660 222 696 664 666 669 670 671 672 674 675 676 677 39 207 208 209 210 211 212 680 681 682 43 683 59 6 84 103 659 205 91 689 690 692 30 215 216 217 218 697 698 700 52 174 705 706 707 220 708 710 711 712 713 714 715 716 717 718 719 720 721 722 23 31 724 219 77 88 17 66 7 30 83 68 120 96 5 667 678 679 685 186 15 726 733 728 731 732 734 221 736 94 95 97 99 41 74 65 105 738 98 38 73 7 4 739 44 740 112 113 114 14 3 1 24 54 81 58; do echo "$Y 203's = ";`cat $thisday | grep ^203 | grep "2C,$Y, | wc -l`; done |
| Sponsored Links | ||
|
|
|
|||
|
should i put this into a subscriber list file
2 144 9 129 16 37 42 45 87 104 53 40 62 63 51 158 18 19 20 21 50 67 82 116 64 100 141 168 170 171 49 84 85 35 34 70 61 69 8 26 27 28 78 79 32 33 10 11 130 25 36 47 57 200 173 6 46 48 55 56 72 118 22 13 110 109 203 29 80 12 660 222 696 664 666 669 670 671 672 674 675 676 677 39 207 208 209 210 211 212 680 681 682 43 683 59 6 84 103 659 205 91 689 690 692 30 215 216 217 218 697 698 700 52 174 705 706 707 220 708 710 711 712 713 714 715 716 717 718 719 720 721 722 23 31 724 219 77 88 17 66 7 30 83 68 120 96 5 667 678 679 685 186 15 726 733 728 731 732 734 221 736 94 95 97 99 41 74 65 105 738 98 38 73 7 4 739 44 740 112 113 114 14 3 1 24 54 81 58 |
|
|||
|
ins@ARTMGA01> awk -F, 'NR==FNR{_[$0];next}$1==X && $3 in _{a++}END{print a}' X="203" a.out `date +%y%m%d`00010202.TLG
333868 ins@ARTMGA01> i get this when i run the above query i am not getting the count of 203's for each subscriber id |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Taking a particular attribute's value in a file... | Llb | Shell Programming and Scripting | 16 | 01-07-2009 07:15 AM |
| script fot taking mount information | arunkumar_mca | UNIX for Advanced & Expert Users | 12 | 10-21-2008 10:37 AM |
| put an interactive script in background after taking input | epsilonaurigae | Shell Programming and Scripting | 7 | 02-15-2008 10:18 PM |
| script to gather weblogic jvm heap size stats | galenw | Shell Programming and Scripting | 2 | 02-07-2008 01:34 PM |
| Shell script is taking more than 3 hrs to execute | nvuradi | Shell Programming and Scripting | 2 | 11-18-2007 11:02 PM |