Open a .raw file as text in less

6,273

Solution 1

The attempt to use isoinfo comes from lesspipe, which is generally used as a helper for less via the LESSOPEN variable.

Running

LESSOPEN= less file.raw

will open file.raw without interpretation.

Solution 2

Another option which doesn't involve setting any variables is to pipe the data through less instead of letting less open the file for you.

$ cat file.raw | less

or

$ less <file.raw

would do the trick.

Share:
6,273

Related videos on Youtube

Jonathan Roberts
Author by

Jonathan Roberts

Updated on September 18, 2022

Comments

  • Jonathan Roberts
    Jonathan Roberts almost 2 years

    The output of my program has a .raw file extension. If I try to open this with less I get:

    No isoinfo available
    Install mkisofs to view ISO images
    

    The file isn't an image file, it's just text. Is there a way to tell less that the file should be opened as plain text?

    • Admin
      Admin about 9 years
      try with strings command: strings file.raw|less
    • Admin
      Admin about 9 years
      If I really want to see what's in a file, I use more rather than less.
    • Admin
      Admin about 9 years
      To really see what's in a file, I use od ;-).
  • Jonathan Roberts
    Jonathan Roberts about 9 years
    This is also great suggestion; if I could accept two answers I would also accept this.
  • Stephen Kitt
    Stephen Kitt about 9 years
    Using redirections into less has a couple of disadvantages: less needs to buffer everything, so it will use more memory (unless -B is specified); it won't know about the file name, and the size will only be available once it's finished reading all the data.