I have a huge number of source files that are all lacking a newline at the end.
How do I automatically add a newline to the end of each of them?
Some may alr
Try ex-way:
ex -s +"bufdo wq" *.c
And recursively (with a new globbing option enabled):
ex -s +"bufdo wq" **/*.c
This is equivalent to vi -es. Change *.c to extension of your interest.
vi -es
*.c
The ex/vi would automatically append newline on save if it's not present.
ex
vi