1

I need a text editor on mac that could open arbitrary file and show its content.

Edit: I dont want to "decode" the files, I just want to read them byte by byte, as they are sitting on the filesystem, just like fopen() in c. (No parsing!) Is there any editor that can do that?

For example, I want to open "test.pages" file, because I am curious. Textedit denied to open it, textWrangler opened it in disk browser. TextMate did open it , showing first 2 characters as PK, (which i understand as a packed file), but it showed lots of special characters as white spaces, which is not acceptable.

Notepad (or any XYZ editor on windows) could open arbitrary files, without ever complaining about "format".

7
  • The best way to get past the os thinking you are stupid is just to change your perspective on it. For instance when it's tell you to how to scroll with the trackpad just see it as the computer saying," hey guy you know how to do this in terminal but you can use this on the off chance that you aren't doing some power computing and are just being a casual user. Thanks bye now." Dec 20, 2014 at 19:52
  • The .pages file is not a archived file the equivalent on Windows is a .zip file and notepad would show the same as TextMate did here
    – mmmmmm
    Dec 20, 2014 at 19:54
  • I understand the OS trying to "Decode", but I want to ponder over that myself, I just need a text editor that shows me file contents as they are on the system, I can create a C program right now to show first 100 characters of file by fopen() and printing as characters. Thats all I need! I dont want to "decode", neither should we rely on its "intelligence". Is there no binary-text editor on mac to open files as they are? Dec 20, 2014 at 19:57
  • 1
    It seems that depending on what the pages documents contains depends on if the .pages is saved as a file bundle or a zip file. Both types get designated the .pages extension. To see this for you self you can use /usr/bin/file foo.pages in terminal
    – markhunte
    Dec 20, 2014 at 20:17
  • You could always try emacs or vi and there are GUI versions :) I use emacs on Windows as well
    – mmmmmm
    Dec 20, 2014 at 20:29

2 Answers 2

3

This seems to be the job for a hex viewer/editor rather than a text editor. An easy way to do this would be just to use Terminal emacs with hex mode.

If you prefer a GUI application Hex Fiend looks promising

  • A fast and clever open source hex editor for Mac OS X.
  • Insert, delete, rearrange. Hex Fiend does not limit you to in-place changes like some hex editors.
  • Work with huge files. Hex Fiend can handle as big a file as you’re able to create. It’s been tested on files as large as 118 GB.
  • Small footprint. Hex Fiend does not keep your files in memory. You won’t dread launching or working with Hex Fiend even on low-RAM machines.
  • Binary diff. Hex Fiend can show the differences between files, taking into account insertions or deletions.
  • Data inspector. Interpret data as integer or floating point, signed or unsigned, big or little endian...
1
  • Awesome!!!! Thank you so much. I don't have enough reputation to up vote right now, but Hex Fiend is more than what I wanted, it shows the bytes of file, staying unbiased of "format" Thank you :') Dec 20, 2014 at 20:27
1

You can open Terminal.app and have a go with nano or vim if you want. When I opened a .pages file with TextWrangler, it opened it up the archived file tree (giving access to all of the files therein). It then showed special sub-files byte-for-byte (for example the PDF preview).

All I did was right-click on the .pages file and Open With… TextWrangler. You may have to change the selection box to "All Applications" instead of "Recommended Applications."

14
  • My experience with fopen() isn't the point, but yes I have. I gave you two other options. I'm not sure why TextMate is giving you trouble, since I don't have it (perhaps it was opened with the wrong encoding, or you're viewing it with a font that doesn't have glyphs for those characters).
    – samh
    Dec 20, 2014 at 20:10
  • Again, using Terminal and TextWrangler in combo: Open Terminal.app, cat file.pages > file.pages.txt … then open the file in TextWrangler. That can even be scripted if you want.
    – samh
    Dec 20, 2014 at 20:13
  • Some .pages will open up as a Directory some will not and will not give you the Show package contents and act more like flat files. I am not sure why but each .pages is different depending on what the document contains
    – markhunte
    Dec 20, 2014 at 20:13
  • Yes, thank you for understanding that I dont want to "decode" or "parse", I just want to read the bytes. textmate did work, and perhaps it was font problem, but its a trial app, is there any free app that could do that? Dec 20, 2014 at 20:13
  • nano and vim are command line tools that come with Mac OS (I'm going to keep suggesting them because you keep throwing fopen() out there).
    – samh
    Dec 20, 2014 at 20:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .