官术网_书友最值得收藏!

  • Ubuntu 20.04 Essentials
  • Neil Smyth
  • 127字
  • 2021-06-11 17:39:43

9.10 Working with Pipes in the Bash Shell

In addition to I/O redirection, the shell also allows output from one command to be piped directly as input to another command. A pipe operation is achieved by placing the ‘|’ character between two or more commands on a command-line. For example, to count the number of processes running on a system, the output from the ps command can be piped through to the wc command:

$ ps –ef | wc –l

There is no limit to the number of pipe operations that can be performed on a command-line. For example, to find the number of lines in a file which contain the name Smith:

$ cat namesfile | grep Smith | wc –l

主站蜘蛛池模板: 丰镇市| 洛川县| 宝兴县| 毕节市| 贺州市| 黑龙江省| 镇安县| 武川县| 芒康县| 呈贡县| 永济市| 虞城县| 繁峙县| 乌拉特后旗| 海南省| 灌云县| 清镇市| 凌海市| 随州市| 沐川县| 武威市| 黄平县| 万山特区| 金湖县| 韶山市| 邵武市| 遂昌县| 德州市| 奉新县| 会同县| 崇左市| 宁国市| 星子县| 石泉县| 牡丹江市| 定襄县| 佛冈县| 安庆市| 安溪县| 长子县| 库车县|