Wo liegt das Problem? Du kannst doch anstelle eines Strings auch
eine Variable angeben, dann wird deren Inhalt als Filename genommen
(zumindest macht es das awk unter SunOS 4.1.1 so). Ich habe folgen-
des mal ausprobiert:
BEGIN { filename = "test" "datei" "name" }
{ print > filename }
Danach stand alles so wie es eingegeben war in der Datei testdateiname.
Siehe auch "The AWK Programming Language", Seite 57:
$3 > 100 { print $1, $3 >"bigpop" }
$3 <= 100 { print $1, $3 >"smallpop" }
Notice that the filenames have to be quoted; without quotes, bigpop
and smallpop are merely uninitialized variables. Filenames can be
variables or expressions as well:
{ print($1, $3) > ($3 > 100 ? "bigpop" : "smallpop") }
does the same job, and the program
{ print > $1 }
puts every input line into a file named by the first field.
Das Buch bezieht sich generell auf das "new awk", vielleicht hast Du
eine alte Version (erkennbar z.B. daran, dass es keine user-defined
functions gibt)?
--
Lutz Birkhahn (Germany) email: lu...@bisun.nbg.sub.org (don't use another!)
F"urther Str. 6 +--------------------------------------------------
D-W-8501 Cadolzburg 2 | "It is an error to not have enough arguments"
Voice: 09103 / 2886 | (Hype Programmer's Guide)