How to remove all white spaces from a given text file

前端 未结 11 1863
无人共我
无人共我 2020-12-13 01:34

I want to remove all the white spaces from a given text file. Is there any shell command available for this ? Or, how to use sed for this purpose.

I wa

11条回答
  •  盖世英雄少女心
    2020-12-13 02:01

    This answer is similar to other however as some people have been complaining that the output goes to STDOUT i am just going to suggest redirecting it to the original file and overwriting it. I would never normally suggest this but sometimes quick and dirty works.

    cat file.txt | tr -d " \t\n\r" > file.txt
    

提交回复
热议问题