Opening a APPLICATION_OCTET-STREAM file only takes a few clicks and is very easy, even for novice users. Compatible with Window XP, Vista, Win7 Need help for.APPLICATION_OCTET-STREAM files call tech experts: (855) 973-2092 (Toll Free, 24*7) * Additional offers may apply.
I have downloaded some log files from my server which I want to search for a specific string for debugging purposes. All of them have the .log extension.
The problem is that one file has the plain text document (text/plain)
mime type while the other has the Binary (application/octet-stream)
mime type.
I can open the plain text document (text/plain)
mime type log file in a text editor as plain text but the other I can't since it's in binary.
How can I view the binary .log files with application/octet-stream
mime type?
2 Answers
From this answer in What makes grep consider a file to be binary?
If there is a NUL character anywhere in the file, grep will consider it as a binary file.
There might a workaround like this cat file tr -d '000' yourgrep
to eliminate all null first, and then to search through file.
I first tried it with one file in a test directory:
And the result, a plain text document (text/plain)
text mime file.
Then since I am working with multiple files, I tried running the same command for multiple files in a directory: Download boruto samehadaku.
Open Application Octet-stream File Windows
And awesome, all my log files are now in a readable format!! :)
Based on your own answer, you seem to be referring specifically to searching files using grep
, rather than to changing a file's mime-type - see What is the XY problem?.
If grep
is simply misidentifying the files based on null bytes, then you can use the -a
or --binary-files=text
options to tell grep to treat them as text regardless, as described in the manual pages: