Converting .dat to UNIX

I uploaded a .dat file from sftp to my server and after using dos2unix to convert the file and check my work it says that the file was not transferred correctly and that the content is garbled. Please help

What application created your .DAT file? Is it an ASCII file?

Did you transfer the file in a compatible mode? Binary or ASCII mode?

sftp older versions only support binary mode which is still the default on newer versions.

Perhaps you need to try the transfer in ASCII mode.

I suggest you check out/read about the different modes of transfer.

I don't think we're dealing with "converting sth. to UNIX". .dat files usually are binary files with an underlying structure understood (more or less) only by the creating and consuming application(s). They are not text files. dos2unix does not apply / do any valuable work. In contrary, it will garble the data.

So, a binary transfer is a must, and on the receiving side an apt application should read, evaluate, and use the binary data. You may want to (binary) compare files before and after transfer.

.dat files can be either binary or text.

Ref:

https://fileinfo.com/extension/dat

Hence, it is more than likely not possible to use dos2unix to convert a .dat file without more information on the file.

Ref:

https://www.unix.com/man-page/centos/1/dos2unix/

The way to proceed in this question:

... is to know what application created the .dat file and if the file is text or binary.

As Rudi mentioned, it is more than likely binary data; so dos2unix is not going to help as that utility is for text files.

So, the ball is in Ovid158's court to tell us what exact application created the .dat file in question and if the file is binary or text, as hicksd8 requested.