Convert binary to text Perl script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Convert binary to text Perl script
# 1  
Old 07-07-2012
Convert binary to text Perl script

Hello everyone,

I have a binary file with a structure unknown. I have found 2 perl scripts that it seems to do the convertion but I get sintactic errors when I run them, may somebody test these 2 scripts please and see if really work?

One if from here
http://www.people.vcu.edu/~elhaij/IntroBioinf/Programs/context/binary6.html

and the other is this one:
unix commands & unix scripts @ coolcommands.com - the search engine for unix sysadmins :: Solaris, AIX, Linux, HP/UX, BSD, SCO

If you know a perl or shell script that do the job please share it Smilie

Thanks in advance
# 2  
Old 07-07-2012
@Ophiuchus
The second script looks like working fine! Can you tell us the errors that you get?
# 3  
Old 07-07-2012
Hello PikK45,

Thanks for answer.

I'm not sure if some library is missing for me or if I'm running the script in wrong way.

I get this:
Code:
$ . conv.pl -t -f binaryfile
Order not found «use», maybe wanted to say:
the order «nse» of packet «ns2» (universe)
the order «muse» of packet «muse» (universe)
the order  «uae» of packet «uae» (multiverse)
use: order not found
my: order not found
my: order not found
bash: conv.pl: line 7: sintax error near unexpected element `('
bash: conv.pl: line 7: `sub tobinary() {'

Thanks in advance for your help.
# 4  
Old 07-07-2012
I hope you are executing the script in a wrong way.

try this
Code:
 ./conv.pl -t -f binaryfile

This works on all unix based platforms Smilie
# 5  
Old 07-07-2012
Now I get access denied when I run it in that way Smilie but if
I send it doing
Code:
$ perl conv.pl -t -f binaryfile

it gives me an output but with many wrong characters
Code:
���l�$�ih�� �A/
��a_z�Dm�$�ih�� �A/
��a_z�@u�&�M&�4ZLB ��}B�����`"&΄��L�(ID��:$�ih�� �A/
��a_z�DE�$�ih�ID���W��W�[Ѐ��L�@ID�Kz �l�@I4��%6�&�i0CE�I4��%�$�ih�ID���W��W�[� �i�-I4��%��$�ih���"    xW�+
���-�$�ih���"    xW�+
���"m�$�i�CE���"    xW�+�W���$�ih���"    xW�+
���"��$�ih��ID���W��W���$�ih�� �A/
��a_z�Du�$�ih�� �A/
��a_z�@M��L�(ID��z �i�QhI4��%��$�ih�I0�^
�¾*����z��l4JID��zI$�h�ID��z$�ih���"    xW�+
�����$�ih�� �A/
��aWz�DM�$�ih���"    xW�+
���l�$�ih�� �A/
��a_z�DE��l4JID��:��L�(ID��:$�ih��ID���W��W�Y�$�ih�� �A/
��a_z�De� �i�,�I4��%��$�i�    E�I0�^
�¾*����z��L�(ID��z$�`��@M�ID��z$�ih�

How could convert completely to text? Smilie
# 6  
Old 07-07-2012
first try to run the program to convert from text to binary and verify whether the program works the way that it is supposed to!!
# 7  
Old 07-07-2012
If I convert some text file to binary with this script the output is 0s and 1s and If I convert the generated binary to text, the conversion is correct.

The issue is the file I want to convert, with this script doesn't show correctly converted to text.

Do you know another script or command to get this?

Thanks again
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Want to convert an expect script to binary in Linux

Does anyone know how to convert an expect script to binary in linux?. (3 Replies)
Discussion started by: John Wilson
3 Replies

2. Shell Programming and Scripting

Convert binary file to csv and then back to the binary format

Hello *nix specialists, Im working for a non profit organisation in Germany to transport DSL over WLAN to people in areas without no DSL. We are using Linksys WRT 54 router with DD-WRT firmware There are at the moment over 180 router running but we have to change some settings next time. So my... (7 Replies)
Discussion started by: digidax
7 Replies

3. Shell Programming and Scripting

convert shell script into a binary executable

Hello every one, i want to convert my shell script into a binary executable a .exe file , is it possible to do that if so are there any tools . Would the script take off when the arguments are parsed. Thanks Venu (13 Replies)
Discussion started by: venu
13 Replies

4. Shell Programming and Scripting

Perl program to convert PDF to text/CSV

Please suggest ways to easily convert pdf to text in perl only on windows (no other tools can be downloaded) Here is what I have been doing : using a module CAM::PDF to extract data. But it shows everything in messy format :wall: But this module is the only one working with the pdf... (0 Replies)
Discussion started by: chakrapani
0 Replies

5. AIX

Convert clear text into binary

Hi I need to display the binary text of an clearn text which is sent as input to the shell script (c shell); ex: I will pass "HELLO" as input, and i should get the binary format of the text Thanks in advance Mohan (1 Reply)
Discussion started by: mKarri
1 Replies

6. Shell Programming and Scripting

Is it possible to convert text file to html table using perl

Hi, I have a text file say file1 having data like ABC c:/hm/new1 Dir DEF d:/ner/d sd ...... So i want to make a table from this text file, is it possible to do it using perl. Thanks in advance Sarbjit (1 Reply)
Discussion started by: sarbjit
1 Replies

7. Shell Programming and Scripting

Is there any script which convert binary file to CSV format

Dear guys; I have a binary file and I need to convert its data to csv format ...appreciating your help. Best Regards (14 Replies)
Discussion started by: ahmad.diab
14 Replies

8. Shell Programming and Scripting

convert binary file into text file

im looking for anothr way to convert binary file into text file im using old solaris version (exatcly like xxd -r) thanks (2 Replies)
Discussion started by: modcan
2 Replies

9. Programming

trying to convert binary data to text using C++

i hav tried to convert binary 2D data into text using binreader and writing into text file using streamwriter. i use ReadSingle() function to convert from binary to ascii, although it works good in 1D data but not in more dimensions. the kind of values i get are -1.265369923E+038 and like ... (2 Replies)
Discussion started by: geet
2 Replies

10. UNIX for Dummies Questions & Answers

How to convert binary Unix file to text

Hi all, I have a print control file (dflt) for Oracle which is in binary. As I am going to develope an application in Window environment, I would like to reference the dflt file. But it is in binary format and I cannot access it. Anyone can suggest me how to convert the file into text or... (5 Replies)
Discussion started by: user12345
5 Replies
Login or Register to Ask a Question