FG

I'm having trouble with a text file being marked as a binary

Fresh3 days ago
Mar 15, 202611221 views
Confidence Score0%
0%

Problem

I have an executable that generates a text file as its output. The problem is that the text file comes out with a binary file flag of some sort. The result is something like this: Some reading has indicated that grep looks for a null character in the first thousand or so bytes, then determines from…

Error Output

$ grep "grep string" output_file.txt
Binary file output_file.txt matches.

$ grep -a "grep string" output_file.txt
[correct results]

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: I'm having trouble with a text file being marked as a binary

Low Risk

I can answer at least the first question. If you're using Unix/Linux you can use tr where \000 is the null char. You can also strip all non-printable chars as you can see on the example here: "Unix Text Editing: sed, tr, cut, od, awk" Regarding your…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment