#!/bin/bash

mlr --nidx --rs '\n\n' --fs '\001' put -q '
  $1 =~ "^mlr "
    || $1 =~ "Command.*termcvt"
    || $1 =~ "Command.*lecat"
    || $1 =~ "Command.*hex"
  {
    @cmd = $1
  }
  $1 =~ "by 0x" {
    @stack_trace = $1;
    @combined = @cmd."\n".@stack_trace;
    emit @combined
  }
' "$@"
