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

  • 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

主站蜘蛛池模板: 辰溪县| 铜梁县| 贵州省| 卢湾区| 察雅县| 双柏县| 会昌县| 雅江县| 收藏| 内丘县| 石渠县| 五常市| 阿拉尔市| 吴堡县| 金湖县| 鱼台县| 云林县| 康定县| 喜德县| 东台市| 怀安县| 广宗县| 孝感市| 哈密市| 安图县| 兴文县| 大埔区| 陆河县| 高密市| 都兰县| 蒙城县| 乡城县| 宁德市| 麻阳| 博野县| 通渭县| 大邑县| 清水县| 茂名市| 全南县| 罗平县|