I have a ncurses dump (with for example screen recorder from GNU screen) and I would like to convert it into text

(there are some conversations in it, some lists and other things, all text, but ncurses formatted, like there is a permanent status bar, a clock, etc. and I really don't want to change subject about which ncurses software I use and how to use that to generate text instead a generic solution ... I open this question be cause isn't only one software, there are few, screen recorder from GNU screen is only an example)

if I use less tool to see file it complain about being binary and then show a lot of garbage

if I use cat, I can see the text, but all pages at once, no way to slow it down or interact with it at all (if I add | less ... it will behave like not using cat at all)

same thing with grep, it will only show all lines at once, if it finds the string

so, any ideas ?

  • One of the online OCR services that will let you upload an image that they then "scan" and convert to text? – ivanivan May 29 '18 at 11:45

You can usually view such files (for some value of “view”) with less -fr: -f forces less to open the file even if it thinks it’s a binary, and -r tells it to pass control characters to the display as-is. Another approach is to display them in the terminal, slowed down so that you can keep track of what’s happening (this is more useful for viewing ANSI animations, but it might help in your case); you can use slowcat for this.

You might get more useful results by using ansi2txt or ansi2html from the colorized-logs tools.

  • ansi2txt seems to be the answer, now file is text, even if, seems like I have a lot of work to do in cutting lines (one very long line) but at least now grep, cut, tr, sed, awk, etc. is working, Thank YOU :) – THESorcerer May 29 '18 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.