6 Usage: ${0##*/} STRACE_LOG
8 Finds all STRACE_LOG.PID files, adds PID prefix to every line,
9 then combines and sorts them, and prints result to standard output.
11 It is assumed that STRACE_LOGs were produced by strace with -tt[t]
12 option which prints timestamps (otherwise sorting won't do any good).
19 elif [ "$1" = '--help' ]; then
26 for file in "$logfile".*; do
27 [ -f "$file" ] || continue
28 suffix=${file#"$logfile".}
29 [ "$suffix" -gt 0 ] 2> /dev/null ||
31 pid=$(printf "%-5s" $suffix)
32 # Some strace logs have last line which is not '\n' terminated,
33 # so add extra newline to every file.
34 # grep -v '^$' removes empty lines which may result.
35 sed "s/^/$pid /" < "$file"
38 | sort -s -k2,2 | grep -v '^$'
42 echo >&2 "${0##*/}: $logfile: strace output not found"