Human readable formatting on the fly with awk

From thelinuxwiki
Revision as of 19:01, 25 February 2013 by Nighthawk (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Convert numerical parameters into human readable text


Example:

# echo 1 | awk '{ if ($1==1) print "Active"; if ($1==0) print "Standby";}'
Active
# echo 0 | awk '{ if ($1==1) print "Active"; if ($1==0) print "Standby";}'
Standby