linuxvimrheldos2unix

dos2unix: Binary symbol found, skipping binary file


I am currently having an issue where my script is failing when trying to execute the dos2unix command on a file.

This is what I have in the script:

dos2unix -n data/file data/tmp_file
dos2unix: Binary symbol found at line 21107611
dos2unix: Skipping binary file data/input/DATA.txt
mv -f data/tmp_file data/input/DATA.txt
mv: cannot stat ‘data/tmp_file’: No such file or directory

I went to the line is question and I have a "^@" here. What is this and how do i get my script to work using the dos2unix command?

{128392938928392838123129381298398129^@ 

Thanks


Solution

  • The ^@ is Vim's representation of a null byte; cp. :help <Nul>

    Ordinary text files do not contain null characters. Binary files typically have many null characters, and they would become corrupted if converted as a whole; that's why dos2unix refuses to convert it.

    You have several options: