File: diff-diag-output

package info (click to toggle)
zeekctl 2.2.0%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,544 kB
  • sloc: python: 5,639; sh: 1,374; makefile: 71; awk: 24
file content (42 lines) | stat: -rwxr-xr-x 1,043 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#! /usr/bin/env bash
#
# Remove content from "zeekctl diag" output that is too system-dependent
# (currently, this includes the contents of stderr.log, stdout.log, PATH,
# ZEEKPATH, OS version, and the system-dependent "No core file" message).

awk '{
    if ( skip == 0 ) {
        if ( $0 ~ /^(Darwin|Linux|[A-Z][a-z]*BSD)/ ) {
            print "<...OS version...>"
        }
        else if ( $0 ~ /^No core / ) {
            print "<...skipped...>"
            skip=1
            skipcount=1
        }
        else if ( $0 ~ /^==== std(err|out)\.log/ ) {
            print
            skip=1
            skipcount=0
        }
        else if ( $0 ~ /^PATH=/ ) {
            print "PATH=<...>"
        }
        else if ( $0 ~ /^ZEEKPATH=/ ) {
            print "ZEEKPATH=<...>"
        }
        else {
            print
        }
    }
    else {
        if ( $0 ~ /^$/ ) {
            print
            skip=0
        }
        else if ( skipcount == 0 ) {
            print "<...skipped...>"
            ++skipcount
        }
    }
}'