File: diff-df-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 (20 lines) | stat: -rwxr-xr-x 547 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#! /usr/bin/env bash
#
# Replace columns from "zeekctl df" output that are not predictable with Xs.

awk '{
    if ( $0 !~ /total[ ]+avail/ )
    {
        $2 = "/xxx/xxx"

        # Check the format of each field, and replace with Xs only if the
        # format is expected (some fields have unpredictable length, but
        # we need a constant-width string of Xs).
        if ( $3 ~ /^[0-9]+[KMG]$/ ) { $3 = "XXX" }
        if ( $4 ~ /^[0-9]+[KMG]$/ ) { $4 = "XXX" }
        if ( $5 ~ /^[0-9]+\.[0-9]$/ ) { $5 = "XX.X" }
    }

    print
}'