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
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:
:help ++ff
, e.g. :w ++ff=unix
). Command-line tools like dos2unix
still have their use for non-interactive invocations.dos2unix
command has a -f|--force
option to enforce conversion.