mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-03 20:40:34 +01:00
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
This commit is contained in:
parent
6fe2bf9cc7
commit
8649fcf02a
1 changed files with 2 additions and 2 deletions
|
|
@ -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 | \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue