if your real file contains region like this try , I just pasted same contents 4 times in 2 file and tested
$ cat file_test1.tmp
Total Subs : 0
VLAN Count : 28129501
Subs Segmentation : 28142
ARPU Segmentation : 0
RTT Delay : 3096610
IPv4 Fragmented Count : 2809853525
IPv4 Non Fragmented Count : 2809853525
Call Drop Rate : 1
Connection with Good voice quality : 45545345
Standalone Dedicated Control Channel (SDCCH) Congestion : 0
Total Subs : 0
VLAN Count : 28129501
Subs Segmentation : 28142
ARPU Segmentation : 0
RTT Delay : 3096610
IPv4 Fragmented Count : 2809853525
IPv4 Non Fragmented Count : 2809853525
Call Drop Rate : 1
Connection with Good voice quality : 45545345
Standalone Dedicated Control Channel (SDCCH) Congestion : 0
Total Subs : 0
VLAN Count : 28129501
Subs Segmentation : 28142
ARPU Segmentation : 0
RTT Delay : 3096610
IPv4 Fragmented Count : 2809853525
IPv4 Non Fragmented Count : 2809853525
Call Drop Rate : 1
Connection with Good voice quality : 45545345
Standalone Dedicated Control Channel (SDCCH) Congestion : 0
Total Subs : 0
VLAN Count : 28129501
Subs Segmentation : 28142
ARPU Segmentation : 0
RTT Delay : 3096610
IPv4 Fragmented Count : 2809853525
IPv4 Non Fragmented Count : 2809853525
Call Drop Rate : 1
Connection with Good voice quality : 45545345
Standalone Dedicated Control Channel (SDCCH) Congestion : 0
$ cp file_test1.tmp file_test2.tmp
$ ls *.tmp -1
file_test1.tmp
file_test2.tmp
awk -F":" '
function stat(){
# print file being used
print p RS
for(i=1;i<=j;i++){
if(C[i,1]){
# If divisible by zero then zero
per = C[i,2] == 0 ? "0" : C[C[i,1],3]/(C[i,2]*100)
X[C[i,1]] = X[C[i,1]] ? X[C[i,1]] OFS per"%" : per"%"
# Variable for future use to print parameter in same order
stop = split(X[C[i,1]],Z,OFS) == 1 ? i : stop
}
}
# Count how many regions are there in file
region = split(X[C[i-1,1]],Z,OFS)
for(i=1;i<=region;i++){
printf i==1 ? "Parameter" OFS "Region"i OFS : \
i < region ? "Region"i OFS : "Region"i RS
}
for(i=1;i<=stop;i++)
print C[i,1],X[C[i,1]];print RS
}
FNR==1{
if(NR != 1){
# Call for each file
stat()
# Reset for each file
j = region = stop = 0
delete X ; delete C; delete Z
}
p = FILENAME
}
{
# Stores Parameter
C[++j,1] = $1
# Stores Parameter Value
C[j,2] = $2
# Sum of each Parameter
C[C[j,1],3] += C[j,2]
}
END{
stat()
}
' OFS=\, *.tmp
file_test1.tmp
Parameter,Region1,Region2,Region3,Region4
Total Subs ,0%,0%,0%,0%
VLAN Count ,0.04%,0.04%,0.04%,0.04%
Subs Segmentation ,0.04%,0.04%,0.04%,0.04%
ARPU Segmentation ,0%,0%,0%,0%
RTT Delay ,0.04%,0.04%,0.04%,0.04%
IPv4 Fragmented Count ,0.04%,0.04%,0.04%,0.04%
IPv4 Non Fragmented Count ,0.04%,0.04%,0.04%,0.04%
Call Drop Rate ,0.04%,0.04%,0.04%,0.04%
Connection with Good voice quality ,0.04%,0.04%,0.04%,0.04%
Standalone Dedicated Control Channel (SDCCH) Congestion ,0%,0%,0%,0%
file_test2.tmp
Parameter,Region1,Region2,Region3,Region4
Total Subs ,0%,0%,0%,0%
VLAN Count ,0.04%,0.04%,0.04%,0.04%
Subs Segmentation ,0.04%,0.04%,0.04%,0.04%
ARPU Segmentation ,0%,0%,0%,0%
RTT Delay ,0.04%,0.04%,0.04%,0.04%
IPv4 Fragmented Count ,0.04%,0.04%,0.04%,0.04%
IPv4 Non Fragmented Count ,0.04%,0.04%,0.04%,0.04%
Call Drop Rate ,0.04%,0.04%,0.04%,0.04%
Connection with Good voice quality ,0.04%,0.04%,0.04%,0.04%
Standalone Dedicated Control Channel (SDCCH) Congestion ,0%,0%,0%,0%
if you need tab separated file then at the end change OFS=\,
to OFS=\\t
, if you are trying on Solaris/Sun OS
use nawk