CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
don't even what subjext title to use

 



pytheas
Novice

Oct 20, 2008, 9:08 AM

Post #1 of 9 (1859 views)
don't even what subjext title to use Can't Post

hi guys. I have been programming in perl for a while but i am a biologist. i need a perl script to convert some binary files (.dcd if anyone knows what they are) to ascii or just extract the ascii that they contain. i tried plain read with no results. does anyone has any guidelines or at least something that i can start with because i am in a total loss. thanks anyway. ! :)


KevinR
Veteran


Oct 20, 2008, 10:42 AM

Post #2 of 9 (1858 views)
Re: [pytheas] don't even what subjext title to use [In reply to] Can't Post

Try searching google:

perl convert binary to ascii

See if you find anything that can help.
-------------------------------------------------


pytheas
Novice

Oct 20, 2008, 10:46 AM

Post #3 of 9 (1856 views)
Re: [KevinR] don't even what subjext title to use [In reply to] Can't Post

mpravo re malaka. me ypoxrewses. sou gamietai i mana. eisai gia ton poutso. kai i mana sou episis. otan se eftiaxne o theos ithele na xesei. ante kai o mpampas einai kalos anthrwpos...



the above in greek means thank you. but i have already checked the net and found almost nothing helpful.


pytheas
Novice

Oct 20, 2008, 11:37 AM

Post #4 of 9 (1852 views)
Re: [pytheas] don't even what subjext title to use [In reply to] Can't Post

I only found this but when i run it it comes out with four columns of something seeming like hexadecimal (0xe15d)


Quote


use warnings;
use strict;

@ARGV == 2 or die "usage: $0 in_filename out_filename\n";

# get first argument, i.e filename
my $in_filename = shift;
print "You chose input <$in_filename>\n";
my $out_filename = shift;
print "You chose output <$out_filename>\n";

#set infile to binary mode
open INFILE, '<:raw', $in_filename or die "can't open $in_filename: $!";

open OUTFILE, '>', $out_filename or die "can't open $out_filename: $!";

# read 8 bytes at a time
$/ = \8;

while ( <INFILE> ) {
print OUTFILE join( ', ', map sprintf( '0x%04x', $_ ), unpack 'S*', $_ ), "\n";
}

any ideas?


KevinR
Veteran


Oct 20, 2008, 12:02 PM

Post #5 of 9 (1850 views)
Re: [pytheas] don't even what subjext title to use [In reply to] Can't Post

Can you post a small sample from the file you need to convert to ascii?
-------------------------------------------------


pytheas
Novice

Oct 20, 2008, 4:24 PM

Post #6 of 9 (1846 views)
Re: [KevinR] don't even what subjext title to use [In reply to] Can't Post

actually its a 700 mb file. i don't know if you are willing enough download it from a rapidashare link if i upload it. Otherwise is there any way to cut a part of it and upload a small sample?


KevinR
Veteran


Oct 20, 2008, 5:38 PM

Post #7 of 9 (1844 views)
Re: [pytheas] don't even what subjext title to use [In reply to] Can't Post

No, I'm not interested in downloading such a file. And I don't know anything about what a .dcd file is or what format/encoding it might be written in. I'm not sure what else to suggest. Post a question on www.perlmonks.com or www.experts-exchange.com if you want to.
-------------------------------------------------


pytheas
Novice

Oct 21, 2008, 1:36 AM

Post #8 of 9 (1828 views)
Re: [KevinR] don't even what subjext title to use [In reply to] Can't Post

ok i managed to cut the first 80 kb from the file with hexedit and i upload it here: http://www.gigasize.com/get.php?d=7qfs5f331bf. if that helps at all


KevinR
Veteran


Oct 21, 2008, 4:33 AM

Post #9 of 9 (1826 views)
Re: [pytheas] don't even what subjext title to use [In reply to] Can't Post

Sorry mate, I have no idea what that file is or what the encoding is. I suggest you ask on www.perlmonks.com
-------------------------------------------------

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives