2
|
1 |
#
|
|
2 |
# matching the following output specified as a pattern that verifies
|
|
3 |
# that the numerical values conform to a specific pattern, rather than
|
|
4 |
# specific values.
|
|
5 |
#
|
|
6 |
# Compiled Failed Invalid Time FailedType FailedMethod
|
|
7 |
# 38 0 0 0.41 0
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
BEGIN {
|
|
12 |
headerlines=0; datalines=0; totallines=0
|
|
13 |
}
|
|
14 |
|
|
15 |
/^Compiled Failed Invalid Time FailedType FailedMethod$/ {
|
|
16 |
headerlines++;
|
|
17 |
}
|
|
18 |
|
|
19 |
# note - the FailedMethod column is not matched very thoroughly by the
|
|
20 |
# following pattern. We just check for zero or more spaces after the
|
|
21 |
# FailedType column and the for any sequence of characters for the
|
|
22 |
# FailedMethod column. Better checking would verify an optional string of
|
|
23 |
# characters that follows class/method name patterns. However, it's very
|
|
24 |
# difficult to generate any data in this column under normal circumstances.
|
|
25 |
#
|
|
26 |
/^[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+[ ]*[0-9]+\.[0-9]+[ ]*[0-9]+[ ]*.*$/ {
|
|
27 |
datalines++;
|
|
28 |
}
|
|
29 |
|
|
30 |
{ totallines++; print $0 }
|
|
31 |
|
|
32 |
END {
|
|
33 |
if ((headerlines == 1) && (datalines == 1) && (totallines == 2)) {
|
|
34 |
exit 0
|
|
35 |
}
|
|
36 |
else {
|
|
37 |
exit 1
|
|
38 |
}
|
|
39 |
}
|