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 -)
The moreutils package has a great command for doing this, called
By default this will use the
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
The text editor joe (aka Joe's Own Editor) does what you want.
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.
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:
Check "man sed" for more details.