You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.2 KiB

# A very simple script to format freedink trace files
# Copyright (C) 2022 CRTS
# This program is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation, version 3.
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <>.
declare in="$1"
declare out="$2"
usage() {
cat <<-EOF
Usage: $0 logfile [outputfile]
if [[ ! -f "$in" ]];then
echo "File not found: $1" >&2
exit 1
if [[ -z "$out" ]];then
out=$(basename "$in").formatted
while read level tag line;do
if [[ "$tag" == "Enter:" ]];then
printf "%*s" $indent
echo "$tag $line"
(( indent++ ))
elif [[ "$tag" == "Exit:" ]];then
printf "%*s" $indent
echo "$tag $line"
printf "%*s" $indent
echo "$tag $line"
done < "$in" > "$out"