-
Notifications
You must be signed in to change notification settings - Fork 3
/
statupd
executable file
·39 lines (37 loc) · 1.02 KB
/
statupd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#! /bin/sh
# helper-script for noad
# update statisticfile from noad-0.3.2/0.3.2a to 0.3.4
if test $# -lt 2
then
echo "usage:"
echo "statupd <statfile> <newstat>"
exit -1
fi
gawk -F';' '{ if(NF > 10) printf("%s\n",$0); \
else {\
for(i=1;i<=NF;i++) {\
if(i==2){\
printf("0.3.2;-;-;");\
}\
if(i!=NF)\
printf("%s;",$i);\
else\
printf("%s",$i);\
}\
printf("\n");\
}\
};' $1 |
gawk -F';' '{ if(NF > 12) printf("%s\n",$0); \
else {\
for(i=1;i<=NF;i++) {\
if(i==2){\
printf("0.3.2;");\
}\
if(i!=NF)\
printf("%s;",$i);\
else\
printf("%s",$i);\
}\
printf("\n");\
}\
};' > $2