1 |
5985
|
aaronmk
|
#!/bin/bash
|
2 |
4675
|
aaronmk
|
# Filters import log files for their import times
|
3 |
|
|
# Usage: self {input...|<input} >filtered
|
4 |
|
|
|
5 |
|
|
sedEreFlag="$(test "$(uname)" = Darwin && echo E || echo r)"
|
6 |
|
|
|
7 |
|
|
sed () { "$(which sed)" -"$sedEreFlag" "$@";}
|
8 |
|
|
|
9 |
7269
|
aaronmk
|
times ()
|
10 |
|
|
{
|
11 |
7501
|
aaronmk
|
sed -n 's/^Took (.*) sec\/([^ ]*) row\(s\).*$/\2'$'\t''\1/p' "$@"
|
12 |
7269
|
aaronmk
|
}
|
13 |
|
|
|
14 |
|
|
postprocessLogs=()
|
15 |
|
|
|
16 |
|
|
for log in "$@"; do
|
17 |
|
|
if test "${log/public./}" != "$log"; then
|
18 |
|
|
postprocessLogs[${#postprocessLogs[@]}]="$log"
|
19 |
|
|
else times "$log"
|
20 |
|
|
fi
|
21 |
|
|
done
|
22 |
|
|
|
23 |
7270
|
aaronmk
|
echo
|
24 |
7269
|
aaronmk
|
echo "Postprocessing logs:"
|
25 |
|
|
times "${postprocessLogs[@]}"
|