Hallo,
"Christian Augustat"
Ich möchte mittels AWK 2 Textdateien miteinander vergleichen,komme aber nicht wirklich weiter, weil ich nicht weiss wie ich nun die 2. Datei innerhalb eines AWK scripts einlese.
Ich möchte mittels eines in der 1. Datei gefunden schlüssels ( ich bastel mir eine REGEX ), in der 2. Datei suchen und wenn ich Treffer bekomme, dann möchte ich den Schlüssel aus der 1. Datei verändern. Also eigentlich nicht sonderlich schwierig - mir fehlt leider da ein Lösungsansatz in AWK.
info gawk (oder auch im Emacs etc) -------------------------------------------------- Using `getline' from a File --------------------------- Use `getline < FILE' to read the next record from FILE. Here FILE is a string-valued expression that specifies the file name. `< FILE' is called a "redirection" because it directs input to come from a different place. For example, the following program reads its input record from the file `secondary.input' when it encounters a first field with a value equal to 10 in the current input file: { if ($1 == 10) { getline < "secondary.input" print } else print } Because the main input stream is not used, the values of `NR' and `FNR' are not changed. However, the record it reads is split into fields in the normal manner, so the values of `$0' and the other fields are changed, resulting in a new value of `NF'. According to POSIX, `getline < EXPRESSION' is ambiguous if EXPRESSION contains unparenthesized operators other than `$'; for example, `getline < dir "/" file' is ambiguous because the concatenation operator is not parenthesized. You should write it as `getline < (dir "/" file)' if you want your program to be portable to other `awk' implementations. (It happens that `gawk' gets it right, but you should not rely on this. Parentheses make it easier to read.) -------------------------------------------------- das geht natürlich auch mit einer Schleife um "getline" etc. Jürgen -- Dr.rer.nat. Juergen Vollmer, Viktoriastrasse 15, D-76133 Karlsruhe Tel: +49(721) 9204871 Fax: +49(721) 24874 Juergen.Vollmer@[informatik-vollmer.de|alumni.uni-karlsruhe.de|acm.org] www.informatik-vollmer.de