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.
现在,我想将输出重定向到一个新启动的文本编辑器,到在startup中显示的主未命名编辑窗口。我尝试了vim和gedit,但没有成功。
myprogram | gedit
myprogram | gvim
Anyone knows about an X11 text editor that would support this?
有人知道X11文本编辑器支持这个吗?
5 个解决方案
#1
17
If you want to redirect stderr
of your program in to gvim
you can do:
如果您想将程序的stderr重定向到gvim,您可以这样做:
myprogram 2>&1 | gvim -
and in case if you want to redirect the stdout
to the editor you can do:
如果你想把stdout重定向到编辑器你可以这样做:
myprogram| gvim -
#2
8
I tried this in Ubuntu 12.04, it works as desired:
我在Ubuntu 12.04中尝试过这个,它工作的很好:
sudo lshw | gedit &
On Ubuntu 14.04
在Ubuntu 14.04
sudo lshw | gedit - &
#3
5
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:
要用任何编辑器在一行内完成这一切,创建一个临时文件,使用gedit打开它,然后在gedit打开后删除它:
echo hello > temp ; gedit temp ; sleep 1 && rm temp &
echo hello > temp;中温度;睡眠1 && & rm温度&
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 <( )
下面的编辑器可以使用vim,但是gedit、geany或emacs似乎无法打开<()创建的标准输入或临时文件
vi <( echo hello )
vi <(echo hello)
echo hello | vi -
回声你好| vi -
#4
2
I don't know of any editor that supports this, but redirecting to a temp file might be easier.
我不知道有哪个编辑器支持这个,但是重定向到临时文件可能更容易。
F=$(mktemp)
myprogram >$F
gedit $F
rm $F
#5
1
history | kate -i
my favorite editor :-)
我最喜欢的编辑器:-)
As already said, when a program does not support such piping, the best way is to use a temporal file in the directory /tmp/ which is usually deleted at the next boot.
如前所述,当一个程序不支持这样的管道时,最好的方法是在目录/tmp中使用一个临时文件,该文件通常在下一次启动时被删除。
history > /tmp/bflmpsvz;mcedit /tmp/bflmpsvz
#1
17
If you want to redirect stderr
of your program in to gvim
you can do:
如果您想将程序的stderr重定向到gvim,您可以这样做:
myprogram 2>&1 | gvim -
and in case if you want to redirect the stdout
to the editor you can do:
如果你想把stdout重定向到编辑器你可以这样做:
myprogram| gvim -
#2
8
I tried this in Ubuntu 12.04, it works as desired:
我在Ubuntu 12.04中尝试过这个,它工作的很好:
sudo lshw | gedit &
On Ubuntu 14.04
在Ubuntu 14.04
sudo lshw | gedit - &
#3
5
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:
要用任何编辑器在一行内完成这一切,创建一个临时文件,使用gedit打开它,然后在gedit打开后删除它:
echo hello > temp ; gedit temp ; sleep 1 && rm temp &
echo hello > temp;中温度;睡眠1 && & rm温度&
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 <( )
下面的编辑器可以使用vim,但是gedit、geany或emacs似乎无法打开<()创建的标准输入或临时文件
vi <( echo hello )
vi <(echo hello)
echo hello | vi -
回声你好| vi -
#4
2
I don't know of any editor that supports this, but redirecting to a temp file might be easier.
我不知道有哪个编辑器支持这个,但是重定向到临时文件可能更容易。
F=$(mktemp)
myprogram >$F
gedit $F
rm $F
#5
1
history | kate -i
my favorite editor :-)
我最喜欢的编辑器:-)
As already said, when a program does not support such piping, the best way is to use a temporal file in the directory /tmp/ which is usually deleted at the next boot.
如前所述,当一个程序不支持这样的管道时,最好的方法是在目录/tmp中使用一个临时文件,该文件通常在下一次启动时被删除。
history > /tmp/bflmpsvz;mcedit /tmp/bflmpsvz