How to remove CTRL-A characters from file using SED?

前端 未结 2 1550
情深已故
情深已故 2021-01-12 06:10

I want to remove all \"^A\" control characters from a file using SED. I can remove all control characters using \'sed s/[[:cntrl:]]//g\' but how can I specify \"^A\" specif

2条回答
  •  生来不讨喜
    2021-01-12 07:05

    to reproduce "^A" simply press Ctrl-v Ctrl-a this will reproduce the ^A in the file

    sed -i -e 's/^A/BLAH/g' testfile
    

    the ^A in that line is the result of me pressing Ctrl-v Ctrl-a

提交回复
热议问题