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

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

主站蜘蛛池模板: 阿克陶县| 普安县| 梁河县| 凌云县| 双辽市| 车致| 青神县| 蛟河市| 彭水| 喀喇沁旗| 沁阳市| 南木林县| 北流市| 新蔡县| 盐亭县| 阿拉善右旗| 泽普县| 望奎县| 泰宁县| 张家界市| 合肥市| 华池县| 大丰市| 镇坪县| 林甸县| 酉阳| 凤翔县| 新龙县| 吉木乃县| 四平市| 达拉特旗| 墨竹工卡县| 无极县| 汕头市| 高邮市| 嘉禾县| 乐平市| 吴桥县| 麻栗坡县| 漳平市| 武安市|