How to remove trailing whitespaces for multiple files?

前端 未结 7 902
长发绾君心
长发绾君心 2020-12-12 14:04

Are there any tools / UNIX single liners which would remove trailing whitespaces for multiple files in-place.

E.g. one that could be used in the con

相关标签:
7条回答
  • 2020-12-12 15:07

    For those that are not sed gurus (myself included) I have created a small script to use JavaScript regular expressions to replace text in files and does the replacement in place:

    http://git.io/pofQnQ

    To remove trailing whitespace you can use it as such:

    $ node sed.js "/^[\t ]*$/gm" "" file
    

    Enjoy

    0 讨论(0)
提交回复
热议问题