Using sed to delete lines – get 00 after each character

filessed

I am trying to eliminate 3 first lines in every *.sql file for which I run the following command:

sed -i '1,3d' *.sql

It eliminates the lines with the side effect that after each character I get a symbol with 00 code (^a)

Why is this happening and how do I get rid of those symbols?

Here is a screenshot of what it becomes:

screenshot of resulting file

Best Answer

You're editing a UTF16 file with an eight-bit aware utility.

Either convert the file using something like iconv or find a UTF16 aware utility to remove the first three lines of each file.

iconv --from-code=UTF16 --to-code=UTF8 < file16.txt > file8.txt
Related Question