How to fix “No newline at end of file” warning for lots of files?

前端 未结 11 1836
抹茶落季
抹茶落季 2020-12-03 01:48

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

11条回答
  •  时光说笑
    2020-12-03 02:43

    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.

    The ex/vi would automatically append newline on save if it's not present.

提交回复
热议问题