danilojara123 danilojara123 - 7 months ago 10
Bash Question

Replace ^A symbol with space with a tab

I have a file where the lines look something like this:

878803058210225308^A12:41:46^A12:41:46^A1^A1


I want to be able to remove the ^A characters. I have tried the tr command but I have not be able to get what I want. I tried this:

tr ^A \\t < myfile1 > myfile2


What would be the best way to do this ?

Thank you

Answer

^A is actually a single character ascii 0x01. It just has a "nickname" of control-A. So you can use this to replace it.

tr '\01' '\t'