You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
437 B
29 lines
437 B
15 years ago
|
#!/usr
|
||
|
# AWK hl test
|
||
|
|
||
|
# BEGIN and END are also matched as patterns
|
||
|
BEGIN {
|
||
|
p = 0;
|
||
|
}
|
||
|
|
||
|
/some pattern/ {
|
||
|
p++;
|
||
|
}
|
||
|
|
||
|
# / inside brackets is not considered end of expression
|
||
|
# a loose division operator (/) is not mismatched as a pattern.
|
||
|
$1 =~ /[^abc/]def/ || b == 3 / 5 {
|
||
|
|
||
|
gsub ( FILENAME );
|
||
|
|
||
|
}
|
||
|
|
||
|
# TODO and FIXME also work in comments in Awk.
|
||
|
|
||
|
# Also backslash in patterns works.
|
||
|
/\/usr\/bin\/awk/ { print "This is me"; }
|
||
|
|
||
|
END {
|
||
|
print p;
|
||
|
}
|