Gawk

From AdminWiki

Revision as of 09:53, 10 April 2009 by Philip (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Problems and Solutions

Get a columns from lines matching a pattern

A small example explains it all:

netstat -s | awk '/active connections/ { print "active.value " $1 } /passive connection ope/ { print "passive.value " $1 } /failed connection/ { print "failed.value " $1 } /connection resets/ { print "resets.value " $1 } /connections established/ { print "established.value " $1 }'
Personal tools