Hi all,
how do you match patterns in an "if-else" fashion?
for example, say I have a set of patterns to match:
/foo/ { print "foo" }
/bar/ { print "bar" }
/.*/ { print "default" }
so for input file:
foo
bar
raboof
I'm getting:
foo
default
bar
default
default
but i would like:
foo
bar
default
Notice the lines "foo" and "bar" match twice. I would like the last pattern to match, only of the other patterns do not match. Does anyone have a solution to this?
-Matt
how do you match patterns in an "if-else" fashion?
for example, say I have a set of patterns to match:
/foo/ { print "foo" }
/bar/ { print "bar" }
/.*/ { print "default" }
so for input file:
foo
bar
raboof
I'm getting:
foo
default
bar
default
default
but i would like:
foo
bar
default
Notice the lines "foo" and "bar" match twice. I would like the last pattern to match, only of the other patterns do not match. Does anyone have a solution to this?
-Matt