Skip to content
Advertisement

How can I extract the text portion of a binary file in Linux/Bash?

I have a binary file. If I open it with vi, it shows sequences of human-readable text and binary characters. What is the best way to extract the human-readable portion only using Bash?

I was thinking, maybe we can do this over a grep or sed pattern?

cat file1.bin | grep '????'  > newfile.txt

Advertisement

Answer

Use the strings utility – that’s exactly what it’s designed for.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement