mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 15:48:06 +02: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;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;33' grep -a --color=always '^\|^\(.* \)\?<info> \[[0-9.]*\]\( .*\<is starting\>.*$\)\?' | \
|
||||||
GREP_COLOR='01;37' grep -a --color=always '^\|\<platform: signal: .*$' | \
|
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;35' grep -a --color=always '^\|\<audit: .*$' | \
|
||||||
GREP_COLOR='01;32' grep -a --color=always '^\|\<device (.*): state change: '
|
GREP_COLOR='01;32' grep -a --color=always '^\|\<device (.*): state change: '
|
||||||
else
|
else
|
||||||
|
|
@ -56,7 +56,7 @@ NM-log() {
|
||||||
else
|
else
|
||||||
a="${1--}"
|
a="${1--}"
|
||||||
shift
|
shift
|
||||||
/usr/bin/cat "$a" "$@"
|
/usr/bin/less "$a" "$@"
|
||||||
fi
|
fi
|
||||||
) | \
|
) | \
|
||||||
NM-colorize | \
|
NM-colorize | \
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue