Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pipe program output in an editor?

Tags:

linux

editor

pipe

I have my program generating some data. It output everything on standard error.

Now I'd like to redirect the output to a newly started text editor, into the main unnamed edit window that shows at startup. I tried with vim and gedit without success.

myprogram | gedit
myprogram | gvim

Anyone knows about an X11 text editor that would support this?

like image 987
Didier Trosset Avatar asked Oct 05 '10 14:10

Didier Trosset


2 Answers

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 -
like image 96
codaddict Avatar answered Sep 20 '22 04:09

codaddict


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) –

like image 21
RoboJ1M Avatar answered Sep 20 '22 04:09

RoboJ1M