I know GEdit has a bug which prevents it from opening a file with null (\0) characters in it. This is a huge inconvenience for me because I frequently have to open big log files with only a couple rogue \0's in them.

Sometimes I just run a quick tr -d '\0' < file.log > file.log.correct and open the correct file. This is a big nuisance. I would like to have maybe an external tool in GEdit that would execute the above command. I tried writing an external tool action (GEdit plugin) using just:

tr -d '\0'

Input is "current document", output action is "replace current document". But this isn't working. When I open the file, GEdit shows the familiar red warning; activating the external tool with the warning showing apparently has no effect (I think the script is being called but its input/output are not set).

Any other ideas I could try?

  • 2
    use a real editor cough vim cough :) – akira Feb 15 '11 at 12:05
  • I thought of that, but this tool does (mostly) all I need it to. – st.never Feb 15 '11 at 15:27

I believe that works on a document that's already loaded rather than one that's in the process of being loaded.

You could use a wrapper script or function that does the tr for you then launches gedit.

| improve this answer | |
  • Fair enough, this is what I ended up doing. Since I am used to navigating to a folder and double-clicking a file to open in GEdit, I created a Nautilus custom action. Now I have a menu item "Remove Null Characters" in my right-click context menu, that I can invoke before viewing the file. – st.never Feb 15 '11 at 15:20

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.