Parsing Through .bin file assistance

Reply

Join Date: Jul 2009
Posts: 1
Reputation: TeamUSA is an unknown quantity at this point 
Solved Threads: 0
TeamUSA TeamUSA is offline Offline
Newbie Poster

Parsing Through .bin file assistance

 
0
  #1
Jul 6th, 2009
Hello everyone,

I've been having a problem parsing through a .bin file. Ideally, I want the script to read the .bin file, find the first word in it, write down word 1 somewhere else, and continue on throughout the file, word by word. I've tried similar things such as

open (MYFILE, 'data.txt');
while (<MYFILE>) {
chomp;
print "$_\n";
}
close (MYFILE);

but it is not effective for the .bin. Any help would be greatly appreciated.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 49
Reputation: onaclov2000 is an unknown quantity at this point 
Solved Threads: 5
onaclov2000 onaclov2000 is offline Offline
Light Poster

Re: Parsing Through .bin file assistance

 
0
  #2
Jul 7th, 2009
Originally Posted by TeamUSA View Post
Hello everyone,

I've been having a problem parsing through a .bin file. Ideally, I want the script to read the .bin file, find the first word in it, write down word 1 somewhere else, and continue on throughout the file, word by word. I've tried similar things such as

open (MYFILE, 'data.txt');
while (<MYFILE>) {
chomp;
print "$_\n";
}
close (MYFILE);

but it is not effective for the .bin. Any help would be greatly appreciated.
Would you please post example data?

It's hard to know how to handle the data if we don't know how it's read in by the script.
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 898
Reputation: KevinADC has a spectacular aura about KevinADC has a spectacular aura about 
Solved Threads: 67
KevinADC's Avatar
KevinADC KevinADC is offline Offline
Practically a Posting Shark

Re: Parsing Through .bin file assistance

 
0
  #3
Jul 7th, 2009
considering that a .bin file is a compressed and encoded file its no wonder you can't just open it like a text file.
Last edited by KevinADC; Jul 7th, 2009 at 2:34 am.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 49
Reputation: onaclov2000 is an unknown quantity at this point 
Solved Threads: 5
onaclov2000 onaclov2000 is offline Offline
Light Poster

Re: Parsing Through .bin file assistance

 
0
  #4
Jul 7th, 2009
That was my suspicion not sure how those are read in....
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 898
Reputation: KevinADC has a spectacular aura about KevinADC has a spectacular aura about 
Solved Threads: 67
KevinADC's Avatar
KevinADC KevinADC is offline Offline
Practically a Posting Shark

Re: Parsing Through .bin file assistance

 
0
  #5
Jul 7th, 2009
There is no standard way that I am aware of. It really makes no sense to search a bin file for "words" but maybe for school work it does.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 165
Reputation: Fest3er is an unknown quantity at this point 
Solved Threads: 18
Fest3er Fest3er is offline Offline
Junior Poster

Re: Parsing Through .bin file assistance

 
0
  #6
Jul 8th, 2009
If you are using unix/linux or cygwin on winders, use the strings() command, as in
  1. strings filename.bin
This command extracts every sequence of printable characters followed by an unprintable character.

Exercises for the student include working with multi-byte character strings, calling the strings command from within perl, and searching for equivalent functionality in perl.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Perl Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC