Problem with binary file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Problem with binary file
# 1  
Old 01-17-2015
Problem with binary file

I have a binary file with all content is text, i want convert this binary to a regular file because i want to parse it.

Thx.

---------- Post updated at 05:01 AM ---------- Previous update was at 04:34 AM ----------

I have found the solution

Code:
cat file | tr -d '\0'

# 2  
Old 01-17-2015
Quote:
Code:
cat file | tr -d '\0'


UUOC
Code:
tr -d '\0' < file

# 3  
Old 01-17-2015
Help me out - what is a
Quote:
binary file with all content is text
?
# 4  
Old 01-17-2015
Quote:
Originally Posted by RudiC
Help me out - what is a
Quote:
Originally Posted by protocomm
I have a binary file with all content is text,
?
A script?
Shot into the blue - the extenstion is probably ".run".

When its already text, why need to change it?
Doesnt do dos2unix not something simliar like that tr command?
# 5  
Old 01-17-2015
Could be e.g. a UTF-16 file; then iconv might be preferrable to tr...
# 6  
Old 01-18-2015
I'm french, it"s possible that's not clear.

In fact, i have a file ArchivePlay.log from a windows PC, inside the file, there are whole text.
When i do:
Code:
file --mime ArchivePlay.log

it says: binary file

after:
Code:
od -bc ArchivePlay.log

I see a lot of
Code:
\0

If i:
Code:
tr -d '\0' ArchivePlay.log

The binary file become a plain text file, i'm happy

I'm wonder, how do the same thing with python, i try to convert the binary file in ascii file but without success
# 7  
Old 01-18-2015
Out of sheer personal curiosity - would you post the (partial) output of od -ctx1 ArchivePlay.log?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Web Development

Problem in printing binary tree using php and mysql

Database Structure Root Table ID Root_ Node Level 1 A 0 2 B 1 3 C 1 Child Table ID Left_Node Right_Node Root_Node Root_ID 1 B C A 1 ... (1 Reply)
Discussion started by: Deepak Tiwari
1 Replies

2. Shell Programming and Scripting

PROBLEM with another binary file

Hello, I want to parse another file, i just want the ascii content, here the result of command od -bc file 0000000 036 000 024 000 000 000 377 376 377 010 060 000 060 000 060 000 036 \0 024 \0 \0 \0 377 376 377 \b 0 \0 0 \0 0 \0 0000020 060 000 062 000 106 000... (21 Replies)
Discussion started by: protocomm
21 Replies

3. 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

4. UNIX for Dummies Questions & Answers

[AIX] Binary file warning for text file.

Hello guys, We had to move from a DC to another, and we are now facing an "issue" with some text files. Looks like that some of our log files are set as binary: file TuxConnectorURA.20121012 TuxConnectorURA.20121012: data or International Language text less TuxConnectorURA.20121012... (2 Replies)
Discussion started by: EnioMarques
2 Replies

5. Shell Programming and Scripting

Output redirection of c binary file to a file in shell script is failing

I am struck up with a problem and that is with output redirection. I used all the ways for the redirection of the output of c binary to a file, still it is failing. Here are the different ways which I have used: ./a.out | tee -a /root/tmp.txt 2>&1 ./a.out | tee -a /root/tmp.txt 1>&1 ./a.out |... (2 Replies)
Discussion started by: Maya29988
2 Replies

6. UNIX for Dummies Questions & Answers

Pipe binary file matches grep results to file

I am using grep to match a pattern, but the output is strange. $ grep -r -o "pattern" * Gives me: Binary file foo1 matches Binary file foo2 matches Binary file foo3 matches To find the lines before/after, I then have to use the following on each file: $ strings foo1 | grep -A1 -B1... (0 Replies)
Discussion started by: chipperuga
0 Replies

7. SCO

SCO unix binary compatibility problem

Hi I am looking for sco xenix binary compatibility utility "cvtomf",(convert omf object to COFF object) Would you please help me ? tnx (3 Replies)
Discussion started by: javad1_maroofi
3 Replies

8. Solaris

problem when decoding a binary file

I tried to decode a binary script using the command 'uudecode'. but it is giving error as 'No begining line'. 'uudecode -o <outfile name> <binary file>' Please help me in resolving this. (4 Replies)
Discussion started by: vamshikrishnab
4 Replies

9. Filesystems, Disks and Memory

UNIX problem concerning Microsoft Office Binary

I just started using Terminal on my Mac this summer, and right now I am having problems making a shell script. This shell should run the "Microsoft Setup Assistant" once I run the Automator Script. Alas, I still have problems. Here is the offending scriptlet: Sudo Tcsh root# cd... (2 Replies)
Discussion started by: chrisfrap
2 Replies

10. Solaris

compiled binary file gives "cannot execute binary file"

Hi, I have two Solaris machines. 1. SunOS X 5.8 Generic_108528-29 sun4u sparc SUNW,Sun-Blade-1500 2. SunOS Y 5.8 Generic_108528-13 sun4u sparc SUNW,Ultra-60 I am trying to buiild a project on both these machines. The Binary output file compiled on machine 2 runs on both the machines. Where... (0 Replies)
Discussion started by: scgupta
0 Replies
Login or Register to Ask a Question