0% found this document useful (0 votes)
3 views6 pages

Session06B Input and Output Formatting

The document discusses the importance of shell programming for all programmers, focusing on the use of pipe operators. It explains how to connect multiple commands using pipes to redirect and manipulate command output effectively. Examples are provided to illustrate the usage of pipe operators in various scenarios.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views6 pages

Session06B Input and Output Formatting

The document discusses the importance of shell programming for all programmers, focusing on the use of pipe operators. It explains how to connect multiple commands using pipes to redirect and manipulate command output effectively. Examples are provided to illustrate the usage of pipe operators in various scenarios.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Shell Programming

A Necessity for all Programmers

Pipe Operators
Nagesh Karmali | Firuza Karmali

Department of Computer Science and Engineering


IIT Bombay
You will learn to ...

• Use pipe operators

Shell Programming – A Necessity for all Programmers By Nagesh | Firuza 2/6


Pipe Operators

• STDOUT and file


• Example 1: ls -l | more
• Example 2: ls -l | tee file.txt
• (| pipe operator: combines two or more commands)
• data/output flows from left to right
• Append to a file: -a
• Example 3: ls -l | tee -a file.txt

Shell Programming – A Necessity for all Programmers By Nagesh | Firuza 3/6


Pipe Operators

• Send output of one command to input of next command


• Use of pipe |
• Connect multiple commands using pipes
• cmd1 | cmd2 | ... | cmdN
• Example 4: ls | wc -l | tee size.txt

Shell Programming – A Necessity for all Programmers By Nagesh | Firuza 4/6


Now, you can ...

• Redirect command output to terminal and file


• Append command output to file
• Using pipe operator to send the output of one command to other

Shell Programming – A Necessity for all Programmers By Nagesh | Firuza 5/6


Thank you
1

Shell Programming – A Necessity for all Programmers By Nagesh | Firuza 6/6

You might also like