Hi,
see
https://www.gnu.org/software/gawk/manual/gawk.html#Readfile-Function
1) There is missing the left parenthesis in while (getline tmp < file) > 0), thus you get a syntax error
2) The function doesn't process well new lines. If you have a file with EOLN at the end of file, the EOLN is missing in contents. And if the file doesn't have the ending EOLN, there is missing the last but one EOLN in contents.
This works for me:
contents = tmp RT
while ((getline tmp < file) > 0)
contents = contents tmp RT
instead of the existing code:
contents = tmp
while ((getline tmp < file) > 0)
contents = contents RT tmp
Regards
Mira