Welcome to LQ and the Programming forum!
Perhaps we should begin by asking the meaning of your example
Code:
awk '{print $0 " -- " FILENAME}']
Is the closing square bracket a typo? If not, how do you think it will be interpreted by your awk command?
Assuming it is a typo and your file is indeed named test.txt, I get this:
Code:
$ cat test.txt
Here is a long line of text
$ awk '{print $0 " -- " FILENAME}' test.txt
Here is a long line of text -- test.txt
It would be helpful if you would tell us the platform and version of awk you are using.
Also, check the test.txt file for presence of any non-printing special characters which might affect the positioning of the FILENAME output.