Edit: Just saw you use ~ and not == so the solution I posted won't work ...
You could write something like this (for consecutive numeric values you
can use split to avoid assigning explicitly the array indexes/elements)
awk 'NR == 1 {
p = "0R00"
h = "/home/user/M/"
e = ".tmp"
u[p 10] = "M1"
u[p 11] = "MC"
u[p 12] = "DuSI"
u[p 14] = "FF"
u[p 18] = "Cg"
}
$47 in u {
print > (h u[$47] e)
}' FS="|" data
Or you can try to build your GNU Awk (>= gawk 3.1.3)
with the --enable-switch option (just found it and I've never used it)
and try the switch statement:
No, it's got nothing to do with 'if/else'. Other (most) languages support both, but not awk.
Once again, radoulov's shown one (elegant) way of emulating switch/case for your particular tasks - you might find it useful to adopt.
not sure if it's the entire script, but it seems like you have an unbalanced '}'. What exactly 'not working'?