Visit The New, Modern Unix Linux Community

Converting .dat to UNIX

Thread Tools Search this Thread
Homework and Emergencies Homework & Coursework Questions Converting .dat to UNIX
# 1  
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
# 2  
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.
# 3  
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.
# 4  
.dat files can be either binary or text.



A DAT file is a generic data file created by a specific application. It may contain data in binary or text format (text-based DAT files can be viewed in a text editor). DAT files are typically accessed only by the application that created them.
Hence, it is more than likely not possible to use dos2unix to convert a .dat file without more information on the file.



The Dos2unix package includes utilities "dos2unix" and "unix2dos" to convert plain text files in DOS or Mac format to Unix format and vice versa.

In DOS/Windows text files a line break, also known as newline, is a combination of two characters: a Carriage Return (CR) followed by a Line Feed (LF). In Unix text files a line break is a single character: the Line Feed (LF). In Mac text files, prior to Mac OS X, a line break was single Carriage Return (CR) character. Nowadays Mac OS uses Unix style (LF) line breaks.
The way to proceed in this question:

Originally Posted by Ovid158
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
... 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.

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #373
Difficulty: Medium
JInterpreter is Java bytecode designed to be executed by the Java virtual machine.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to use 'ls' command to list files like *.dat, not *.*.dat?

How to use 'ls' command to list files like *.dat, not *.*.dat (5 Replies)
Discussion started by: pmcginni777
5 Replies

2. Shell Programming and Scripting

Help with Getting distinct record count from a .dat file using UNIX command

Hi, I have a .dat file with contents like the below: Input file ============SEQ NO-1: COLUMN1========== 9835619 7152815 ============SEQ NO-2: COLUMN2 ========== 7615348 7015548 9373086 ============SEQ NO-3: COLUMN3=========== 9373086 Expected Output: (I just... (1 Reply)
Discussion started by: MS06
1 Replies

3. Shell Programming and Scripting

Date format change in UNIX .dat file

Hi, I need help to convert the date format in .DAT file in unix. I want to convert 10@@|SWIFT MT568 Extract@@|Apr 14 2014 5:47:52:563PM@@|Apr 14 2014 4:33:47:663PM@@||##| into 10@@|SWIFT MT568 Extract@@|04/14/2014/ 5:47:52:563PM@@|04/14/2014 4:33:47:663PM@@||##| Appreciate... (18 Replies)
Discussion started by: karthikengox
18 Replies

4. Shell Programming and Scripting

Remove <CR><LF> from the dat file in unix

Hi, The source system has created the file in the dat format and put into the linux directory as mentioned below. I want to do foloowing things. a) Delete the Line started with <CR><LF> in the record b)Also line ...........................................................<CR><LF> ... (1 Reply)
Discussion started by: mr_harish80
1 Replies

5. UNIX and Linux Applications

Seismic Unix convert .dat to .su

Hello, is here anybody who know How I convert the .dat format files to .su format files in SeismicUnix. Is it possible? The dat-format files was generated when I run the forel's script, like . Thanks a lot Vianney (1 Reply)
Discussion started by: vianney
1 Replies

6. Shell Programming and Scripting

How to add spaces to test.dat file in unix??

Hi I have a test.dat file in UNIX which has a data.I am informatica developer i get data in those files.I need to add 50 spaces to those data in test.dat file.I am new to unix So can any one help how can i do that. I have some 2088 rows in that test.dat file. Can anyone help me please its... (11 Replies)
Discussion started by: karingulanagara
11 Replies

7. SCO

SCO UNIX DAT Tape Device

Looking for specifically naming convention for a tape device for SCO Unix What full system backup command should I use for SCO UNIX (1 Reply)
Discussion started by: jedimaster
1 Replies

8. UNIX for Dummies Questions & Answers

How do I delete a data string from a .dat file in unix

I have a .dat file in unix and it keeps failing file validation on line x. How do I delete a data string from a .dat file in UNIX? I tried the following: sed -e 'data string' -e file name and it telling me unrecognized command (4 Replies)
Discussion started by: supergirl3954
4 Replies

9. Shell Programming and Scripting

How to read from a .dat file in Unix

Hi All, I have a .dat file named test.dat where I have stored some process IDs. Now I need to pick a process ID, one by one and then fire kill -9 for each of those. The logic should be: 1. open file <filename.dat> 2. read until last line of file 3. if process ID is found fire kill -9... (5 Replies)
Discussion started by: Sibasish
5 Replies

10. UNIX for Dummies Questions & Answers

Back-up Commands For Hp-unix (hp Surestore Dat 24)

Can Anyone Be Any Assistance To Help A New User Get His Back-up Commands Defined Along With Other Useful Information On Viewing What's On Tapes And Restoring Data From The Tapes. (0 Replies)
Discussion started by: ricjoh
0 Replies

Featured Tech Videos