I am using awk on windows. I have a script called test.awk . This script should read the file and replace a certain amount (key) with a value. A list of key-> values ββis located in a file called translate.txt .
The structure is as follows:
e;Emil f;Friedrich g;Gustaf h;Heinrich i;Ida
In a simple example, my input file will be
e,111 f,222 g,333 h,444 i,555 ..
therefore the output should be
Emil,111 Friedrich,222 Gustaf,333 Heinrich,444 Ida,555 ..
script I use the key2value user key2value to replace, but I am unable to pass this function to another translate.txt file as the source. See my code:
{ FS="," d=key2value($1) print d "," $2 } function key2value(b) {
Another thing is that FS does not work, it starts to work only from the second line.
source share