The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Convert UTF8 Format file to ANSI format rajreddy UNIX for Dummies Questions & Answers 9 05-25-2007 08:26 AM
Convert UTF8 Format file to ANSI format rajreddy UNIX for Advanced & Expert Users 1 05-24-2007 06:40 AM
convert mmddyy date format to ccyyddd format?? Bhups Shell Programming and Scripting 2 09-27-2006 11:30 PM
How to convert file format ? maheshsri Shell Programming and Scripting 3 11-08-2005 12:51 PM
human readable format of file size when doing ls –l umen UNIX for Dummies Questions & Answers 1 09-28-2005 09:20 AM

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

Join Date: Mar 2008
Posts: 5
To convert multi format file to a readable ascii format

Hi

I have a file which has ascii , binary, binary decimal coded,decimal & hexadecimal data with lot of special characters (like öƒ.ƒ.„İİ¡Š·œƒ.„İİ¡Š· ) in it. I want to standardize the file into ASCII format & later use that as source .

Can any one suggest a way a logic to convert such files to ASCII formats. IS there anything in Perl /shell scripting that can fulfill this reqm.

pls suggest how to convert the file.

thanks,
Gaur.Deepti
  #2 (permalink)  
Old 03-25-2008
drl's Avatar
drl drl is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 704
Hi.
Quote:
unpack TEMPLATE,EXPR
"unpack" does the reverse of "pack": it takes a string and
expands it out into a list of values. (In scalar context, it
returns merely the first value produced.)

The string is broken into chunks described by the TEMPLATE.
Each chunk is converted separately to a value. Typically,
either the string is a result of "pack", or the bytes of the
string represent a C structure of some kind.

-- excerpt from perldoc -f unpack
I have used this to process a graphics mixed text and binary file. In general, it's best to know the exact layout, although it might be interesting to try doing some auto-recognition of the pieces.

Best wishes ... cheers, drl
  #3 (permalink)  
Old 03-25-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
You mean a 7-bit format which can be converted back to the original? Try base64.

If you want the readable parts to remain readable, and there's not too much binary data, the MIME quoted-printable encoding might work.

The mimencode command from the metamail suite can encode and decode these formats. (Its original name was mmencode I think; you might have it by that name.)
  #4 (permalink)  
Old 03-25-2008
gaur.deepti gaur.deepti is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 5
Hi drl/era,

Thanks for your quick replies !

As I am new to unix..could you pls tell me in more detail that will be helpful for me ....

Thanks,
Gaur.Deepti
  #5 (permalink)  
Old 03-25-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
unpack is a tool, you can invent basically any format which is suitable for your needs and it will be fairly easy to encode and decode.

base64 looks like this:

SSB3aXNoIHlvdSBjb3VsZCB0cnkgdGhpcyB5b3Vyc2VsZgo=

It's what's used inside email messages for attachments if you "view source" (or are old enough to telnet to your IMAP server :-)

quoted-printable replaces any non-ascii with an escape code, consisting of an equals sign and a hex code, =3Dlike this=3D (just to give you an idea).

You really need to give more details to work on, or just pick one.
  #6 (permalink)  
Old 03-25-2008
gaur.deepti gaur.deepti is offline
Registered User
  
 

Join Date: Mar 2008
Posts: 5
Thanks era,

I have lot and lot of junk values and other data type values...first of all i will test what ever you told for a sample file and see the results....

Thanks a lot for your time and patience for guiding me

Thanks,
Gaur.Deepti
Sponsored Links
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 01:43 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