Move under www to ease rsync
This commit is contained in:
36
www/eps/hpr2438/hpr2438_switch_example.awk
Executable file
36
www/eps/hpr2438/hpr2438_switch_example.awk
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/awk -f
|
||||
|
||||
#
|
||||
# Example of the use of 'switch' in GNU Awk.
|
||||
#
|
||||
# Should be run against the data file 'file1.txt' included with the second
|
||||
# show in the series: http://hackerpublicradio.org/eps/hpr2129/file1.txt
|
||||
#
|
||||
NR > 1 {
|
||||
printf "The %s is classified as: ",$1
|
||||
|
||||
switch ($1) {
|
||||
case "apple":
|
||||
print "a fruit, pome"
|
||||
break
|
||||
case "banana":
|
||||
case "grape":
|
||||
case "kiwi":
|
||||
print "a fruit, berry"
|
||||
break
|
||||
case "strawberry":
|
||||
print "not a true fruit, pseudocarp"
|
||||
break
|
||||
case "plum":
|
||||
print "a fruit, drupe"
|
||||
break
|
||||
case "pineapple":
|
||||
print "a fruit, fused berries (syncarp)"
|
||||
break
|
||||
case "potato":
|
||||
print "a vegetable, tuber"
|
||||
break
|
||||
default:
|
||||
print "[unclassified]"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user