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
^A is byte 1 or \x01
so you should be able to do this:
sed 's/\x01//g'
Keep in mind that for single-byte changes, "tr" is faster than sed, although you'll have to use bash's $'..'
syntax to give it a 0x01 byte:
tr -d $'\x01'
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