#!/usr/bin/bash
#
# Replace absolute paths with the basename.

# The drive letter portion of the Windows regex below is adapted from
# https://github.com/stdlib-js/stdlib/blob/develop/lib/node_modules/%40stdlib/regexp/basename-windows/lib/regexp.js
sed -E 's#/+#/#g' |
    sed -E 's#[^( ]*testing_btest#<___>testing_btest#' |
    sed -E 's#([a-zA-Z]:)?/([^	 :/]{1,}/){1,}([^	 :/]{1,})#<...>/\3#g' |
    sed -E 's#([a-zA-Z]:|[\\/]{2}[^\\/]+[\\/]+[^\\/]+)([\\/]{1,2})([^	 :\\/]{1,}[\\/]{1,2}){1,}([^	 :\\/]{1,})#<...>/\4#g' |
    sed -E 's#<\.\.\.>/[a-zA-Z]:<\.\.\.>/#<...>/#g' |
    sed -E 's#\.exe([^.a-zA-Z0-9])#\1#g; s#\.exe$##g' |
    sed -E 's#<\.\.\.>/zeek,#zeek,#g'
