0

I had this string and to show the special characters and then replace

0|A0140017511|1|DEMÁS TEMAS|�|�|2014-08-01

I want this

 0|A0140017511|1|DEMÁS TEMAS|@|@|2014-08-01

$ xxd -p file.txt

307c41303134303031373531317c317c44454dc381532054454d41537c00
7c007c323031342d30382d3031
Brayan Pastor
  • 874
  • 7
  • 12

1 Answers1

2

From xxd's output I can tell that you're trying to replace NULs with something else. To replace them with a single character, for example -, use tr:

$ tr '\0' '-' < file
0|A0140017511|1|DEMÁS TEMAS|-|-|2014-08-01

Or if you have GNU sed, you can use a string as well:

$ sed 's/\x0/^@/g' file
0|A0140017511|1|DEMÁS TEMAS|^@|^@|2014-08-01
oguz ismail
  • 1
  • 16
  • 47
  • 69