0

I want to recover text from a .doc file that wouldn't open in any text editors (msoffice word, libreoffice writer).

I have found this answer saying to use a command like

strings foo.doc | less

And it seems that a lot of the text is in this way visible in terminal.

But while I am trying to copy/paste, only what is in the actual terminal window is copied - that is less than a page.

How to select and copy all the text accessed in terminal?

1
  • 1
    Save the output to another file strings foo.doc > new_file
    – heemayl
    Feb 24, 2015 at 16:48

1 Answer 1

1

strings will print only the printable characters in a file. To get what you want you just need to save the output of strings to another file and then read the new file in the usual manner. Here is the way:

strings foo.doc > bar.doc

Now bar.doc will contain the strings having printable characters from foo.doc.

2
  • 1
    @cipricus: No problem, although i had this commented first, the important thing is the problem is resolved. Also note that you don't need less as mentioned in the other answer. So, strings foo.doc > output.txt will do.
    – heemayl
    Feb 24, 2015 at 17:11
  • 1
    less was not good in the given case anyway because a lot of useful text recovered was separated into short lines of 5-6 characters
    – user47206
    Feb 24, 2015 at 17:13

You must log in to answer this question.