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
}'
|