Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
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

1 Answer 1

up vote 1 down vote accepted

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.

share|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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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