Я загрузил некоторые файлы журналов с моего сервера, которые я хочу найти для конкретной строки для целей отладки. Все они имеют расширение .log.
Проблема заключается в том, что один файл имеет тип mime plain text document (text/plain), а другой имеет тип mime Binary (application/octet-stream).
Я могу открыть plain text document (text/plain) mime type log file в текстовом редакторе как обычный текст, а другой я не могу, так как он находится в двоичном формате.
Как просмотреть файлы двоичного файла .log с типом application/octet-stream mime?
На основе вашего собственного ответа вы, похоже, ссылаетесь конкретно на поиск файлов с помощью grep, а не на изменение типа mime-файла - см. «Что такое проблема XY».
Если [ f3] просто неверно идентифицирует файлы на основе нулевых байтов, тогда вы можете использовать опции -a или --binary-files=text, чтобы сообщить grep рассматривать их как текст вне зависимости от того, как описано на страницах руководства:
-a, --text
Process a binary file as if it were text; this is equivalent to
the --binary-files=text option.
--binary-files=TYPE
If the first few bytes of a file indicate that the file contains
binary data, assume that the file is of type TYPE. By default,
TYPE is binary, and grep normally outputs either a one-line
message saying that a binary file matches, or no message if
there is no match. If TYPE is without-match, grep assumes that
a binary file does not match; this is equivalent to the -I
option. If TYPE is text, grep processes a binary file as if it
were text; this is equivalent to the -a option. Warning: grep
--binary-files=text might output binary garbage, which can have
nasty side effects if the output is a terminal and if the
terminal driver interprets some of it as commands.