Author: Adam <git@apiote.xyz>
join log lines
get.sh | 4 ++-- log_parser.awk | 8 ++++++++ toymaker.sh | 2 +-
diff --git a/get.sh b/get.sh index e961f138bdda6f0e8067fc5fe4174ed310b0170b..56c4a4fa9244da5f103bf120ff6f4e8b2880fe7b 100644 --- a/get.sh +++ b/get.sh @@ -44,10 +44,10 @@ printf 'n;' elif [ ! -f "toys/$toy/$item.exit" ] then printf 'r;' - cat "toys/$toy/$item.log" + awk -f log_parser.awk "toys/$toy/$item.log" else printf '%s;' "$(cat "toys/$toy/$item.exit")" - cat "toys/$toy/$item.log" + awk -f log_parser.awk "toys/$toy/$item.log" fi } diff --git a/log_parser.awk b/log_parser.awk new file mode 100644 index 0000000000000000000000000000000000000000..70ffb12b226c27efe67bdc0f470fb1674e9dd310 --- /dev/null +++ b/log_parser.awk @@ -0,0 +1,8 @@ +$3=="P" { + for(i=4; i<=NF; i++) line = sprintf("%s%s%s", line, $(i), OFS); +} +$3=="F" { + printf("%s%s%s%s%s", $1, OFS, $2, OFS, line) + for(i=4; i<=NF; i++) printf("%s%s", $(i), i<NF ? OFS : "\n"); + line="" +} diff --git a/toymaker.sh b/toymaker.sh index b44ca7db18161ca44756337397ab5f7cce8b8451..e66909f19d7b20ba717254917e11b136c43a9ccd 100755 --- a/toymaker.sh +++ b/toymaker.sh @@ -362,7 +362,7 @@ done } # dependency verification -for cmd in nc argon2 podman base64; do +for cmd in nc argon2 podman base64 awk; do command -v $cmd >/dev/null || { echo "$0: \`$cmd\` not found"; exit 2; } done