0

I am trying to check if a file has already EOF character is so do nothing, if not then add a new line characer to the end of the file in shell script.

currently i am using :

sed -i -e '$a\' file

getting error message : sed: Not a recognized flag: i

Gilles Quénot
  • 173,512
  • 41
  • 224
  • 223
Rinku
  • 55
  • 1
  • 6
  • 1
    Use `echo '' >> file` – anubhava Nov 17 '14 at 22:38
  • I do not believe this question should have been closed. A very relevant difference between this question and [Missing newline character?](http://stackoverflow.com/questions/26923317/missing-newline-character) is that in this question, it is not known in advance whether a file ends with a newline character. –  Nov 17 '14 at 23:18

0 Answers0