- improve awk readability
- eliminate unnecessary calls to external tools (e.g. cat)
This commit is contained in:
parent
dca80b2844
commit
0962b7dd9f
16
intr_
16
intr_
@ -49,7 +49,12 @@ if [ $# -lt 1 ]; then
|
||||
|
||||
case ${STAT_TYPE} in
|
||||
cpu)
|
||||
cat ${STATFILE} | ${AWK} '{ FS = "[ ]{2,}" } /^cpu/{split($1,name,":"); print name[1]".value "$2}'
|
||||
${AWK} '
|
||||
{ FS = "[ ]{2,}" }
|
||||
/^cpu/ {
|
||||
split($1,name,":");
|
||||
print name[1]".value "$2;
|
||||
}' ${STATFILE}
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -70,7 +75,14 @@ elif [ "$1" == "config" ]; then
|
||||
echo "graph_vlabel interrupts / second"
|
||||
echo "graph_category system"
|
||||
|
||||
cat ${STATFILE} | ${AWK} '{ FS = "[ ]{2,}" } /^cpu/{split($1,name,":"); print name[1]".label "$1"\n"name[1]".type DERIVE\n"name[1]".min 0"}'
|
||||
${AWK} '
|
||||
{ FS = "[ ]{2,}" }
|
||||
/^cpu/ {
|
||||
split($1,name,":");
|
||||
print name[1]".label "$1;
|
||||
print name[1]".type DERIVE";
|
||||
print name[1]".min 0";
|
||||
}' ${STATFILE}
|
||||
;;
|
||||
esac
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user