分类:
2011-06-13 23:10:08
{ if ( $5 ~ /root/ ) { print $3 } } |
{ if ( $1 == “foo” ) { if ( $2 == “foo” ) { print “uno” } else { print “one” } } else if ($1 == “bar” ) { print “two” } else { print “three” } } |
BEGIN { x=0 } /^$/ { x=x+1 } END { print “I found ” x ” blank lines. :)” } |
x=”1.01″ # We just set x to contain the *string* “1.01″ x=x+1 # We just added one to a *string* print x # Incidentally, these are comments |
{ if ( NF > 2 ) { print $1 ” ” $2 “:” $3 } } |
{ #skip header if ( NR > 10 ) { print “ok, now for the real information!” } } |