/foo/ { print }
/[0-9]+.[0-9]*/ { print }
$1 == "fred" { print $3 }
$5 ~ /root/ { print $3 }
{
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"
}
}
! /matchme/ { print $1 $3 $4 }
{
if ( $0!~ /matchme/ ) {
print $1 $3 $4
}
}
( $1 == "foo" ) && ( $2 == "bar" ) { print }
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:)
2.01
{ print ($1^2)+1 }
FS="t+"
FS="[[:space:]]+"
FS="foo[0-9][0-9][0-9]"
NF == 3 { print "this particular record has three fields: " $0 }
{
if ( NF > 2 ) {
print $1 " " $2 ":" $3
}
}
(NR < 10 ) || (NR > 100) { print "We are on record number 1-9 or 101+" }
{
#skip header
if ( NR > 10 ) {
print "ok,now for the real information!"
}
}
Jimmy the Weasel
100 Pleasant Drive
San Francisco,CA 12345
(编辑:台州站长网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!