I used to use NEdit as a graphical text editor, but lately it no longer works right due to lack of maintenance. So I am looking for a replacement. Is there any graphical text editor that can send a selection of text directly to a shell command that is NOT defined in advance?

In NEdit, you select a chunk of text, tell it to filter it through a shell, and have a window come up where you enter the shell command (for example awk '{print $1}') and immediately get back the output of that command in the editor.

What other tool can be used to have the same functionality?

  • 3
    Im certain this can be done with vim, though I do not recall how to do it. Im not sure, if vim graphical enough? if not, there is Gvim, and Cream GUIs for vim.
    – j0h
    Sep 11, 2015 at 13:54
  • I suggest vim, vim has several "graphical" interfaces such as gvim and cream (there are alternates). See linux.com/learn/tutorials/…
    – Panther
    Sep 11, 2015 at 13:55

2 Answers 2


With gVim, select the text, type :! and the command you want. The selected lines will be replaced by the output of the command.

An example:

Editing /etc/apt/sources.list: enter image description here

Selected the text and pressed :! (the '<,'> in the command line is automatically added), with command awk '{print $3}': enter image description here

The text was replaced with the output: enter image description here

Of course, Vim's regex is powerful enough that I wouldn't use an external program (especially not sed, probably not awk) with it. Some care has to be taken with the commands - % with various suffixes is used to add information about the file (:!echo % prints the path of the file, for example), so you'll have to escape those.

Note that the :! command without a range (or selection) does not replace any lines. With selected text, the '<,'> is automatically added when you type : to enter the command line.

  • Hmm, thank you, that works. It's not entirely comfortable (vi(m) with it split command/edit mode isn't really intended as a GUI program) but it should be fine for quickly generating commands from some logs/output.
    – shodan
    Sep 14, 2015 at 12:49

Using Gedit :


  1. xclip, install from a terminal as sudo apt-get install xclip
  2. Gedit plugin External Tools. The goal of this plugin is to allow users to execute external commands from gedit interface.

To install the plugin, open gedit go to Edit -> Preferences -> Plugins -> External Tools.

enter image description here


To configure the plugin, go to Tools -> Manage External Tools...

A dialog will appear.

  1. Add a new tool using the Add + button name it RunSelection
  2. Assign shortcut keys, here I have used Alt+J
  3. Change Edit, Save, Input, Output and Applicability as shown in the following screenshot.

enter image description here

How to run

  1. First select some text in gedit that you want to run in terminal.
  2. Run the external tool "RunSelection" you just set by hitting Alt+J on your keyboard or navigating to Tools -> External Tools

How it works

  1. When you select some text in gedit, it appears in X selections (clipboard).
  2. xclip -o makes the selection available to standard out and stores the value in a variable. (mcmd in above case)
  3. Finally the command is passed to gnome-terminal.
  • Hmm, not quite. This will execute a command selected in the editor and return the output. I need it to execute a command ON an selection of text and return the output.
    – shodan
    Sep 14, 2015 at 12:36
  • @shodan you can have several options in output. Just change "nothing" in output to your desired output. Or if you ask I can extend the script as your need. But clearly tell me where you want the output to appear.
    – sourav c.
    Sep 15, 2015 at 4:34
  • I'm not sure it is possible with external tools, to be honest. The workflow would be: Select some text. run plugin. Give plugin a command that would work in a shell, like awk '{print $2}'. Get the selection replaced by the output of the command you gave with the original selection as input. The point is that the command you are running needs to be given as parameter,not be defined statically.
    – shodan
    Sep 17, 2015 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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