diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-07-10 15:50:53 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-07-10 15:53:28 +1200 |
commit | ffbe8ea91633b29e3f7ca040d3e148f34de11d10 (patch) | |
tree | 20ab8ad25f91e533b313c4e13058fc940ac1b1ea | |
parent | Strip trailing lines (diff) | |
download | nwatch-ffbe8ea91633b29e3f7ca040d3e148f34de11d10.tar.gz nwatch-ffbe8ea91633b29e3f7ca040d3e148f34de11d10.zip |
Add some ad-hoc Awk filtering to the output
It may be possible to accomplish some/all of this with Nmap or Ndiff
features, but I can't see how just yet.
-rwxr-xr-x | nwatch | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -71,5 +71,18 @@ done # Write diff to stdout if it exists (not an error if it doesn't) if [[ -r $diff ]] ; then - cat -- "$diff" + awk '/^[-+]Not shown: / { next } +/^[-+]/ { diff = 1 } +NF { lines[++l] = $0 } +function write() { + if (diff) { + for (l in lines) + print lines[l] + print "" + } + diff = l = 0 +} +!NF { write() } +END { write() } +' -- "$diff" fi |