command line used for creating filename.tar.gz is as follows:
tar -zcvf filename.tar.gz file*.*
OUTPUT FROM ZCAT filename.tar.gz
20130701/
0001750020745500000000000082010060000000000 USSDlike 0000000000000429496704040
5899136999995
000000000000002148063927402YD-MTSBAL 519132008926477227 1120130701074546201307020745460000000001121005060000000001
405891369335696 MTSCHNAOC 2471 00000000000004294967040405899136999995
000000000000003148064263403YD-MTSBAL 519131878925724626 1120130701074550201307020745500000000001134005060000000000
MTSCHNAOC 00000000000004294967040405899136999995
Above is the input
Now for required output, i have placed a check for printing those lines which only have 02 in 26th field of the input line & 07 in the 84th field with 2 as length.
if(substr($0,26,2)=="02" && substr($0,84,2) == mon)
So in case it matches then i print the output in a file, count no of match & also the filename from where condition has matched,i.e,
if
filename.tar.gz
is having 10 files with file names say file1, file2... file10, then for every condition matched above should print something like this
000000000000002155850114502YD-MTSBAL 519132008641092603 1120130714101521201307151015210000000001038005060000000001
405891743536224 MTSCHNAOC 2458 00000000000004294967040405899136999995
000000000000002155850114502YD-MTS 519132008641092603 1120130715101521201307151015210000000001038005060000000001
405891743536224 MTSCHNAOC 2458 00000000000004294967040405899136999995
Since the above is the matched condition so match counter will be increased accordingly.
In the end i would need match & not match count for each file & for match condition output to be in a.txt. Content of countfile should look something like this
file1 match count, notmatch count
file2 match count, notmatch count
file3 match count, notmatch count
.
.
.
file10 match count, notmatch count
Content of
a.txt
should look as mentioned above
since i have space constraints so untar cannot be done :(.
Hope this clarifies....