echo Hello World | nano - | less

I want to modify Hello -> Goodbye while in the the text editor.

It does not have to be with nano. I am stuck with nano reading stdin but requiring me to write to a file (writing to - creates a file named -)

  • This one is also related: Read and confirm shell script before piping from curl to sh (curl -s url | sh)
    – slm
    Apr 19, 2014 at 19:47
  • @slm, I think it makes more sense to close the other Q as a dupe of this since this one is the broader case.
    – Graeme
    Apr 19, 2014 at 20:17
  • @Graeme - I would tend to agree w/ you but the other one has your answer as well, though not as well written. Some merging might be more apt. Maybe we should enlist the help of a mod to help w/ these 2? I'll ping one about it.
    – slm
    Apr 19, 2014 at 20:24
  • @slm, I think we can leave it to whoever is going through the close queue and let the crowd decide. The main difference as I see it is that the other Q is a special case of this where you only want one end of the pipe.
    – Graeme
    Apr 19, 2014 at 21:27
  • 1
    @Graeme - if we don't prime the pump on it then ppl will likely close the newer to the older as a dup.
    – slm
    Apr 19, 2014 at 21:28

3 Answers 3


The moreutils package has a great command for doing this, called vipe. From the man page:

       command1 | vipe | command2

       vipe allows you to run your editor in the middle of a unix pipeline and
       edit the data that is being piped between programs. Your editor will have
       the full data being piped from command1 loaded into it, and when you close
       it, that data will be piped into command2.

By default this will use the editor command, which is usually just a symlink to the default command line editor. You can change this by either altering the link (use update-alternatives on Debian based systems) or using the EDITOR environmental variable. Eg, you could do:

echo Hello World | EDITOR=nano vipe | less

Otherwise, if the particular text editor doesn't have support for this kind of thing, I think you are stuck with manually creating a temporary file, writing the file to that, running the editor, inputting the file to the rest of the pipeline and removing the temporary file. The vipe command basically takes care of all this. This is nice, but the command is rarely available by default.


If all you want is to replace "Hello" with "Goodbye" (or any other word replacement) you can avoid the manual editing in an editor in favor of automatic search&replace tool. For example "sed" can do such replacements like this:

echo Hello World | sed 's/Hello/Goodbye/' | less

Check "man sed" for more details.


The text editor joe (aka Joe's Own Editor) does what you want.

The command echo "hello world" | joe - | less functions as expected, although it needs the quotes for some reason.

Some commands (such as gpg) produce displayed output that does not enter the pipe. This corrupts the initial display inside of joe, but hitting ctrl+r -- refresh -- will clean things up.

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.