How to remove trailing whitespaces with sed?

后端 未结 10 887
我在风中等你
我在风中等你 2020-11-28 21:49

I have a simple shell script that removes trailing whitespace from a file. Is there any way to make this script more compact (without creating a temporary file)?

<         


        
10条回答
  •  遥遥无期
    2020-11-28 22:14

    Thanks to codaddict for suggesting the -i option.

    The following command solves the problem on Snow Leopard

    sed -i '' -e's/[ \t]*$//' "$1"
    

提交回复
热议问题