$ gcc -c no_eof.c no_eof.c:9:2: warning: no newline at end of file #### perl -i -pl -eof file1 file2 ... #### perl -i -pe '$_ .= $/ if eof and not /\n/' file1 file2 ...