Pipes and Filters - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

Pipes and Filters

Description:

Unix commands alone are powerful, but when you combine them together, you can ... One of the most commonly used filters is grep. grep ... – PowerPoint PPT presentation

Number of Views:115
Avg rating:3.0/5.0
Slides: 7
Provided by: jayso
Category:
Tags: filters | grep | pipes

less

Transcript and Presenter's Notes

Title: Pipes and Filters


1
Pipes and Filters
2
Pipes Filters
  • You can construct powerful Unix command lines by
    combining several Unix commands.
  • Unix commands alone are powerful, but when you
    combine them together, you can accomplish complex
    tasks with ease.

3
Using a Pipe
  • The symbol is the Unix pipe symbol that is used
    on the command line. It sends the standard output
    of the command to the left of the pipe to the
    standard input of the command to the right of the
    pipe
  • This is similar to the gt symbol used to redirect
    the standard output of a command to a file
  • However, the pipe is different because it is used
    to pass the output of a command to another
    command, not a file

4
Here is an example
  • miller.cs cat apple.txtcore worm seed
    jewelmiller.cs cat apple.txt wc 2
    4 21miller.cs
  • After the first shell prompt, we see the contents
    of the file apple.txt
  • In the next shell prompt, the cat command
    displays the contents of the applex.txt file
  • The contents are displayed, not to the screen,
    but through a pipe to the wc (word count) command
  • The wc command then does its job and counts the
    lines, words, and characters of its input

5
Using a Filter
  • A filter is a Unix command that does some
    manipulation of the text of a file
  • One of the most commonly used filters is grep

6
grep
  • search for a string in a a file, display the line
    in which it appears
  • miller.cs cat apple.txtcore worm seed
    jewelmiller.cs grep jewel apple.txtseed jewel
  • miller.cs cat apple.txt grep jewel seed jewel
Write a Comment
User Comments (0)
About PowerShow.com