How to remove ^Z (eof) using sub in awk

I am looking for the substitution expression to remove the eof ^Z character at the end of a file in UNIX.

Can anyone help?

Thank you !

check this thread out:

same issue, just substitute ^M with ^Z

Since you are working with DOS text files, unix has a utility called either dos2ux or dos2unix which cleans up all the non-unix crud in DOS files moved to unix.