Removing Control Characters from a File

后端 未结 4 1834
野的像风
野的像风 2020-12-03 05:20

I want to delete all the control characters from my file using linux bash commands.

There are some control characters like EOF (0x1A) especially which are causing th

4条回答
  •  醉话见心
    2020-12-03 05:35

    Instead of using the predefined [:cntrl:] set, which as you observed includes \n and \r, just list (in octal) the control characters you want to get rid of:

    $ tr -d '\000-\011\013\014\016-\037' < file.txt > newfile.txt
    

提交回复
热议问题