#!/bin/bash #/ NAME #/ sanitize-log -- Sanitizes chef run output for comparison #/ #/ SYNOPSIS #/ #/ sanitize-log # figure out the project root under which bin, lib live shome="$(cd -P -- "$(dirname -- "$0")/.." && pwd -P)" # load a meat library source "$shome/libexec/_jason" "$@" # entry point function main { local pth_log="$1"; shift cat "$pth_log" | \ perl -pe 's{^\[\d\d\d\d-\d\d-\d\dT\d\d:\d\d:\d\d-\d\d:\d\d\]\s*}{}' | \ perl -pe 'm{^(INFO: Chef Run complete|Run options|Finished tests)} && s{\d+}{XXX}g' | \ perl -pe 's{line \d+[)]$}{line XXX)}' | \ perl -pe 's{/tmp/[ab]/}{/}g' } require sub "$BASH_SOURCE" "$@"