summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-11-21 14:54:54 +0100
committerThomas Haller <thaller@redhat.com>2017-11-21 15:14:32 +0100
commit8649fcf02ad0646ebbf2daea2ededd0ee4a5745a (patch)
tree76993e40aab18234a6f8014b7d720b76f122db0f
parent6fe2bf9cc7bbbc28166dbe57c27bf3d44bd0f3c1 (diff)
downloadNetworkManager-8649fcf02ad0646ebbf2daea2ededd0ee4a5745a.tar.gz
contrib: use less in NM-log to pre-process input
GNU less supports filters. That makes it nice to use instead of cat. Also, less is well suited for output to a pipe. With this, `NM-log nm-log.txt.gz` works as you would expect
-rwxr-xr-xcontrib/scripts/NM-log4
1 files changed, 2 insertions, 2 deletions
diff --git a/contrib/scripts/NM-log b/contrib/scripts/NM-log
index 4ef02c724a..5e78c41fb1 100755
--- a/contrib/scripts/NM-log
+++ b/contrib/scripts/NM-log
@@ -38,7 +38,7 @@ NM-colorize() {
GREP_COLOR='01;31' grep -a --color=always '^\|^\(.* \)\?<\(warn> \|error>\) \[[0-9.]*\]' | \
GREP_COLOR='01;33' grep -a --color=always '^\|^\(.* \)\?<info> \[[0-9.]*\]\( .*\<is starting\>.*$\)\?' | \
GREP_COLOR='01;37' grep -a --color=always '^\|\<platform: signal: .*$' | \
- GREP_COLOR='01;34' grep -a --color=always '^\|\<platform\(-linux\)\?: link: \(add\|adding\|change\|setting\|deleting\) \|\<platform: address: \(deleting\|adding or updating\) IPv. address:\? \|\<platform: route: \([a-z]\+\|adding or updating\|new\[0x[0-9A-Za-z]*\]\) \+IPv. route:\? \|\<platform-linux: sysctl: setting ' | \
+ GREP_COLOR='01;34' grep -a --color=always '^\|\<platform\(-linux\)\?: link: \(add\|adding\|change\|setting\|deleting\) \|\<platform: address: \(deleting\|adding or updating\) IPv. address:\? \|\<platform: route: \([a-z]\+\|adding or updating\|new\[0x[0-9A-Za-z]*\]\) \+IPv. route:\? \|\<platform-linux: sysctl: setting ' | \
GREP_COLOR='01;35' grep -a --color=always '^\|\<audit: .*$' | \
GREP_COLOR='01;32' grep -a --color=always '^\|\<device (.*): state change: '
else
@@ -56,7 +56,7 @@ NM-log() {
else
a="${1--}"
shift
- /usr/bin/cat "$a" "$@"
+ /usr/bin/less "$a" "$@"
fi
) | \
NM-colorize | \