3

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:

#!/bin/bash
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
  • 2
    use a real editor cough vim cough :)
    – akira
    Feb 15, 2011 at 12:05
  • I thought of that, but this tool does (mostly) all I need it to.
    – st.never
    Feb 15, 2011 at 15:27

1 Answer 1

1

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.

1
  • 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, 2011 at 15:20

You must log in to answer this question.

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