#! /usr/bin/env bash
#
# Remove content from "broctl diag" output that is too system-dependent
# (currently, this includes the contents of stderr.log, stdout.log, PATH,
# bro version, and system information).

awk '{
    if ( $0 ~ /^==== std(err|out)\.log/ ) {
        print; skip=1
    } else if ( $0 ~ /^====/ ) {
        print; skip=0
    } else if ( $0 ~ /^$/ ) {
        print
    } else if ( skip == 0 ) {
        if ( $0 ~ /^PATH=/ ) {
            print "PATH=<...>"
        }
        else if ( $0 ~ /^BROPATH=/ ) {
            print "BROPATH=<...>"
        }
        else if ( $0 ~ /^Bro / ) {
            skip=1
        }
        else {
            print
        }
    }
}'
