Difference between revisions of "Human readable formatting on the fly with awk"

From thelinuxwiki
Jump to: navigation, search
(Pushed from thelinuxwiki.com.)
 

Latest revision as of 19:01, 25 February 2013

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