The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
ascii to ebcdic conversion er_ashu Shell Programming and Scripting 1 02-01-2008 05:43 PM
ascii to binary conversion in sco 5.0.5 sameek1211 SCO 1 12-17-2007 07:49 AM
ascii conversion rintingtong Shell Programming and Scripting 0 04-15-2004 01:18 PM
ASCII file sherbet808 UNIX Desktop for Dummies Questions & Answers 1 06-13-2003 10:46 PM
binary to ascii conversion jimcook42 UNIX for Dummies Questions & Answers 2 10-10-2001 02:29 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-31-2008
mora mora is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 3
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 (permalink)  
Old 03-31-2008
jgt jgt is offline
Registered User
  
 

Join Date: Apr 2007
Location: 44.21.48N 80.50.15W
Posts: 455
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 (permalink)  
Old 03-31-2008
mora mora is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 3
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 (permalink)  
Old 03-31-2008
quine quine is offline
Registered User
  
 

Join Date: Mar 2008
Location: Bay Area California
Posts: 68
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 (permalink)  
Old 03-31-2008
jgt jgt is offline
Registered User
  
 

Join Date: Apr 2007
Location: 44.21.48N 80.50.15W
Posts: 455
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:29 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0