Project

General

Profile

1
#!/bin/bash
2
# 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
times ()
10
{
11
    test "$#" -gt 0 || exit 0
12
    sed -n 's/^Took (.*) sec\/([^ ]*) row\(s\).*$/\2'$'\t''\1/p' "$@"\
13
|grep -vE '^1	'
14
}
15

    
16
postprocessLogs=()
17

    
18
for log in "$@"; do
19
    if test "${log/public./}" != "$log"; then
20
        postprocessLogs[${#postprocessLogs[@]}]="$log"
21
    else times "$log"
22
    fi
23
done
24

    
25
echo
26
echo "Postprocessing logs:"
27
times "${postprocessLogs[@]}"
(34-34/86)