是否可以将一个程序的输出重定向到不同操作系统中的另一程序的输入? [英] Is it possible to redirect output of one program to input of other program in different operating systems?

查看:180
本文介绍了是否可以将一个程序的输出重定向到不同操作系统中的另一程序的输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Unix操作系统中,可以将一个程序的输出重定向到另一个程序的输入.

It is possible to redirect the output of one program to the input of another program within Unix operating systems.

cat *.txt | sort | uniq > result-file

是否可以在其他操作系统(例如Windows)上执行此操作?

Is it possible to do this with other operating systems (like Windows)?

推荐答案

最常见的操作系统具有标准输入,标准输出和管道的概念.但是,命令行语法取决于您使用的shell.

The most common operating systems have notions of standard input, standard output and pipes. The command-line syntax, however, depends on the shell you are using.

您可以通过 Cygwin 获取Windows版Bash.

You can get Bash for Windows with Cygwin.

您还可以在Windows上使用纯老式CMD.exe的管道.语法非常相似,使用>写入文件,使用>>追加,使用<从文件中读取,使用|在进程之间进行管道传输.您可以在此处了解更多信息: http://ss64.com/nt/syntax-redirection.html

You can also use pipes on Windows with plain old CMD.exe. The syntax is very similar, using > to write to files, >> to append, < to read from files and | for piping between processes. You can read more about it here: http://ss64.com/nt/syntax-redirection.html

如果您是使用PowerShell的冒险型用户,则可以在此处阅读有关程序之间管道的信息: http://technet.microsoft.com/en-us/library/ee176927.aspx

If you are the adventurous type that uses PowerShell, then you can read about piping between programs here: http://technet.microsoft.com/en-us/library/ee176927.aspx

这篇关于是否可以将一个程序的输出重定向到不同操作系统中的另一程序的输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆