How to pipe program output in an editor? How to pipe program output in an editor? linux linux

How to pipe program output in an editor?


If you want to redirect stderr of your program in to gvim you can do:

myprogram 2>&1 | gvim -

and in case if you want to redirect the stdout to the editor you can do:

myprogram| gvim -


I tried this in Ubuntu 12.04, it works as desired:

sudo lshw | gedit &

On Ubuntu 14.04

sudo lshw | gedit - &

Dimitry K added on Jan 22 '16 at 19:00 the following

I think you still need dash after:

gedit sudo lshw | gedit - & 

(tried ubuntu 14.04 and only with dash it works) –


To do this all in one line with any editor, create a temporary file, open it with gedit, then delete it once gedit has it open:

echo hello > temp ; gedit temp ; sleep 1 && rm temp &

The following works with an editor such as vim, but gedit, geany or emacs seem to be unable to open standard input or temporary files as created by <( )

vi <( echo hello )

echo hello | vi -