I have a set of files which have null bytes roughly at every second byte slot. Further, they have the byte sequence FF FE at the beginning, which needs to be removed. I was given the files (they are actually router configuration files, so plain text), and I have no idea how those bytes got in there. However, the file looks like this, which I found for example here or here, :
FF FE 65 00 6E 00 61 00 62 6C 00 6C 65 00 0D 00
0A 00 63 00 6F 00 6E 00 66 00 69 00 37 00 75 00
72 00 65 00 20 00 74 00 65 00 72 00 6D 00 69 00
Think you can imagine how it goes on. I tried various things to remove the null bytes and the first 2 bytes as well:
sed -i.bak 's/\x00//g' R2.txt
does nothing.LC_ALL=C sed -i.bak 's/\x00//g' R2.txt
does nothing.LC_ALL=C tr < R2.txt -d '\000' > R2-test.txt
works, but is not in line.LC_ALL=C sed -i.bak $'s/\x00//g' R2.txt
complains aboutsed: 1: "s/": unterminated substitute pattern
So... my question is, how to remove the null bytes the first two bytes (FF FE) from this file, inline, on OSX?
Thanks.