Add a newline only if it doesn’t exist
sed GNU: sed -i ‘$a\’ *.txt OS X: sed -i ” ‘$a\’ *.txt $ addresses the last line. a\ is the append function. OS X’s sed sed -i ” -n p *.txt -n disables printing and p prints the pattern space. p adds a missing newline in OS X’s sed but not in GNU sed, … Read more