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

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

主站蜘蛛池模板: 平遥县| 阿拉善右旗| 呈贡县| 古丈县| 剑川县| 双江| 沁源县| 惠安县| 抚远县| 宣化县| 扎赉特旗| 广昌县| 渑池县| 六枝特区| 合山市| 双峰县| 平度市| 建昌县| 广宗县| 榕江县| 胶南市| 海兴县| 南雄市| 临高县| 桐城市| 玉门市| 益阳市| 长子县| 柳江县| 山阴县| 巴东县| 正镶白旗| 开平市| 海晏县| 连云港市| 绥江县| 观塘区| 二连浩特市| 郯城县| 太白县| 临西县|