How to filter only printable characters in a file on Bash (linux) or Python?

前端 未结 4 1005
挽巷
挽巷 2021-01-18 23:45

I want to make a file including non-printable characters to just only include printable characters. I think this problem is related to ACSCII control action, but I could not

4条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-18 23:56

    You can try this sed command to remove all non-printable characters from a file:

    sed -i.bak 's/[^[:print:]]//g' file
    

提交回复
热议问题