File conversion to ascii


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users File conversion to ascii
# 1  
Old 03-31-2008
File conversion to ascii

Hi All,

I have a data file which has binary and hexa decimal data..i tried to convert that file using dd and od commands but i am getting some numbers and junk values...

Please let me know is there any other command which can convert this file to ascill.

Awaiting your responses

-Mora
# 2  
Old 03-31-2008
If you know how the file was created, it is probably faster to write a program in the same language, to read the current file and convert the fields to ascii and then create a new output file which is all text.
If you don't know how the file was created, then you have first to decide where each field starts and ends, how to translate each field, whether there are negative numbers, and what is the record separator (if any).
"hd" will help with this.
It is also possible that there is data compression/encryption in the record, in which case you will only be able to read the file with the software that created it.
# 3  
Old 03-31-2008
Hello Jgt,

Thanks for your quick response.

The file was created in binary mode and ftp ed to our unix box.

The file is fixed width file and it has no negative numbers.

There are no data compressions as far as i know..

Pls give me little more details about hd command..that will be helpfull

-Mora
# 4  
Old 03-31-2008
I'm not sure where you are going with this... What will it accomplish to convert a file containing legitimate 8-bit characters into pure 7-bit representations?? Is this what you mean by ASCII (really "text"), the first 128 characters of the 256 character UTF-8 set character set???

To do the above requires that 8-bit characters be represented as 2 7-bit characters. One very early way of doing this (for file attachments when there was no other way to "attach" binary files to email) was/is called uuencode (and uudecode to change it back to original form). Your unix system will have some man pages on this program. But again I'm not sure what you are really talking about. If this was a regular TEXT file transmitted in BINARY mode by mistake then the only thing you might have to do is translate line endings -- CR/LF [windows] to LF [unix] for example. If that is what is going on you could use a simple sed script to strip CR (ascii character 13, 0d in hex)...
# 5  
Old 03-31-2008
The hd command displays a file in hexadecimal and ascii where there is a printable character for the hex value. (otherwise it displays a dot.)

usage:
hd file |more
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

EBCDIC to ASCII conversion

Hi, We have a mainframe file which is in EBCDIC format.We dont have direct access to mainframe ,client has provided us the mainframe file.The mainframe file is containing pact data(COMP1 ,COMP2 etc) which are unreadble.Can anyone suggest me how to convert this kind of ebcdic file to ascii... (11 Replies)
Discussion started by: swapna_1990
11 Replies

2. UNIX for Advanced & Expert Users

EBCDIC to ASCII conversion

Hi, I have a input file which is EBCIDIC and it has packed decimals. Can anyone help me to convert EBCIDIC file to ASCII(Need to convert even Packed decimal values also to normal format). Thanks swapna (12 Replies)
Discussion started by: swapna_1990
12 Replies

3. Shell Programming and Scripting

File conversion from Binary to ASCII though UNIX command

Hi All , I have a mainframe file which contains the data in EBCDIC format.I have downloaded this file from mainframe to windows in binary format(unreadable raw data).Now I want convert this file to ASCII format(readable format data) through Unix command.I have tried iconv but that is not working... (2 Replies)
Discussion started by: STCET22
2 Replies

4. Shell Programming and Scripting

ASCII to UTF-8 conversion

I Am trying to change the file encoding from ASCII to UTF-8 using below command iconv -f ASCII -t UTF-8 <input_file> > <output_file> But the output_file is not actually in UTF-8 format. If I use the file command to check the file encoding it still says ASCII. While converting am not... (5 Replies)
Discussion started by: Sriranga
5 Replies

5. Shell Programming and Scripting

binary to ascii conversion

Hi, I have got a library file, created by compiling C code. The file information with "file" command, gives it a "application/x-archive" type file. I want to extract the release string of my software from this file, so that i can know which version of C files were used to create the lib. Can... (3 Replies)
Discussion started by: atulmt
3 Replies

6. UNIX for Dummies Questions & Answers

Conversion from EBCDIC to ASCII

when i try to convert a mainframe EBCDIC file to ASCII ,i dont see correct file this is the source file ... (3 Replies)
Discussion started by: venkatvelpula
3 Replies

7. Shell Programming and Scripting

need help with ascii to decimal conversion

Hi, Can anyone please help me ascci to decimal conversion in bash I have a file which contains stream of numbers like this,these are ascci values 729711810132973278105991013268971213233 I want to covert it to its actual value like upper code's decimal is "Have a Nice Day!" ... (15 Replies)
Discussion started by: sunilmenhdiratt
15 Replies

8. Shell Programming and Scripting

help needed with ASCII conversion

I have a file say "codefile" here ,contains data like this Hi! How are you? I need to covert this data into stram of equivalant ASCII values I wrote follwoing script. #!/bin/bash while read -n1 char do printf "%d" \'$char done < codefile this gives me output ... (4 Replies)
Discussion started by: sunilmenhdiratt
4 Replies

9. Shell Programming and Scripting

ascii to ebcdic conversion

Hello, I need a program for ascii to ebsdic conversion. If anybody can help, it'll be greatly appreciated. Thanks. (1 Reply)
Discussion started by: er_ashu
1 Replies

10. Shell Programming and Scripting

ascii conversion

after converting my ebcidic file to ascii i get the following output 2097152+0 records in 1797345+1 records out Why is there a difference in number of records. Is the converson chopping off any records. All i am doing is just a conversion using the following script dd if=xaa cbs=152 ... (0 Replies)
Discussion started by: rintingtong
0 Replies
Login or Register to Ask a Question