examples/demo_has_prefix
raw| 1 | #!/usr/bin/env runawk |
| 2 | |
| 3 | #use "has_prefix.awk" |
| 4 | |
| 5 | # This demo checks if $1 has a prefix $2 |
| 6 | |
| 7 | # Input files for this demo: examples/demo_has_prefix.in* |
| 8 | |
| 9 | { |
| 10 | if (has_prefix($1, $2)) |
| 11 | printf "yes, `%s' begins with `%s'\n", $1, $2 |
| 12 | else |
| 13 | printf "no, `%s' does not begin with `%s'\n", $1, $2 |
| 14 | } |