Presentation is loading. Please wait.

Presentation is loading. Please wait.

PIPES, FILTERS, AND REDIRECTION Additional Adds by David Sims.

Similar presentations


Presentation on theme: "PIPES, FILTERS, AND REDIRECTION Additional Adds by David Sims."— Presentation transcript:

1 PIPES, FILTERS, AND REDIRECTION Additional Adds by David Sims

2 Redirection of Standard I/O (Input/Output) CTEC 110 Pipes, Filters & Redirection (22 slides)2

3 Redirection of Standard I/O (Input/Output) CTEC 110 Pipes, Filters & Redirection (22 slides)3

4 Redirection of Standard I/O (Input/Output) Not all Commands deal with standard Input and Output Symbols used for redirection: > (Greater Than) < (Less Than) >> (Double Greater Than) CTEC 110 Pipes, Filters & Redirection (22 slides)4

5 Redirection Can redirect both Input and Output of filter commands Some of the most common filter commands are: – SORT – MORE – FIND CTEC 110 Pipes, Filters & Redirection (22 slides)5

6 Piping  Standard output of one program is used as standard input to next program  Used with filter commands to further refine data  Not limited to two programs. Can use several pipes on one line. CTEC 110 Pipes, Filters & Redirection (22 slides)6

7 Combining Commands with Pipes and Filters A command must be on either side of pipe Output of one command is input of the other Redirection is different and should not be confused with piping CTEC 110 Pipes, Filters & Redirection (22 slides)7

8 Using SORT CTEC 110 Pipes, Filters & Redirection (22 slides)8

9 Using SORT Open up a Command Prompt and change to Z:\CTEC110\MyScripts Try the following: 1.SORT MERCURY VENUS EARTH 3 MARS JUPITER Press F6 function key Results should be similar to previous slide! CTEC 110 Pipes, Filters & Redirection (22 slides)9

10 2.SORT 333 3 23 124 Press F6 function key What kind of results did you get? Was it as expected? CTEC 110 Pipes, Filters & Redirection (22 slides)10 Using SORT

11 3.SORT 333 ##3 #23 124 Press F6 function key What results did you get here? Is it what was expected? CTEC 110 Pipes, Filters & Redirection (22 slides)11 Using SORT

12 SORT Command with Redirection Try these out (Copy PERSONAL.FIL and STATE.CAP to MyScripts)… You will use the “Command Prompt” for the following… Copy from the MyScriptsBook directory to MyScripts directory on the Z-Drive! 1.COPY Z:\CTEC110\MyScriptsBook\STATE.CAP 2.SORT < STATE.CAP 3.SORT STATE.CAP 4.SORT /R < STATE.CAP 5.SORT /+17 STATE.CAP … CTEC 110 Pipes, Filters & Redirection (22 slides)12

13 SORT Command with Redirection 6.SORT /+17 STATE.CAP > SORTED.CAP 7.TYPE SORTED.CAP 8.SORT /+17 STATE.CAP /O BYCITY.CAP 9.TYPE SORTED.CAP 10.TYPE BYCITY.CAP CTEC 110 Pipes, Filters & Redirection (22 slides)13

14 Using the MORE Filter Try the following: Remember! COPY Z:\CTEC110\MyScriptsBook\PERSONAL.FIL 1.DIR C:\WINDOWS | MORE 2.Press Enter until back at system prompt 3.DIR C:\WINDOWS | MORE 4.Press the Space Bar 5.DIR C:\WINDOWS | MORE 6.Q … CTEC 110 Pipes, Filters & Redirection (22 slides)14

15 Using the MORE Filter 7.DIR C:\WINDOWS | SORT /+39 | MORE 8.Press Space Bar until end and then Q 9.MORE PERSONAL.FIL 10.Press Space Bar until end and then Q 11.TYPE PERSONAL.FIL | MORE 12.Press Space Bar until end and then Q … CTEC 110 Pipes, Filters & Redirection (22 slides)15

16 Using the MORE Filter 13.MORE PERSONAL.FIL /C +20 14.MORE SORTED.CAP BYCITY.CAP /C 15.Press the Space Bar 16.MORE SORTED.CAP BYCITY.CAP 17.Press the Space Bar 18.Close all open windows and return to desktop environment, the GUI CTEC 110 Pipes, Filters & Redirection (22 slides)16

17 Extended Features of MORE Try the following: 1.Click Start/Run 2.Type in only CMD.EXE /X 3.Click OK 4.CD /d Z:\CTEC110\MyScripts 5.MORE PERSONAL.FIL 6.Press Enter twice 7.Press Q … CTEC 110 Pipes, Filters & Redirection (22 slides)17

18 Extended Features of MORE 8.MORE PERSONAL.FIL 9.Key in P 10.Key in 5 11.Press the = sign 12.Press S 13.Key in 3 Leave the command prompt open… CTEC 110 Pipes, Filters & Redirection (22 slides)18

19 Using the FIND Filter Try the following: 1.CLS 2.FIND “Smith” PERSONAL.FIL 3.FIND /V “Smith” PERSONAL.FIL 4.FIND /N “Smith” PERSONAL.FIL 5.FIND /C “Smith” PERSONAL.FIL 6.FIND /I “Jones” PERSONAL.FIL 7.FIND “Jones” PERSONAL.FIL /I CTEC 110 Pipes, Filters & Redirection (22 slides)19

20 Combining Commands 1.FIND “Teacher” PERSONAL.FIL | FIND “CA” 2.FIND “Teacher” PERSONAL.FIL | FIND “CA” > TEACHER.FIL 3.TYPE TEACHER.FIL 4.FIND “PrOfeSSor” PERSONAL.FIL | FIND “AZ” | SORT 5.Press the up arrow key once 6.Use the left arrow-move to P in PERSONAL.FIL … CTEC 110 Pipes, Filters & Redirection (22 slides)20

21 Combining Commands 7.Key in /I  uppercase letter (i) 8.Press the End key 9.Press Enter 10.DIR C:\WINDOWS | SORT /+39 | MORE 11.Press Space Bar until end and then Q 12.DIR C:\WINDOWS | FIND “ ” | SORT /+39 CTEC 110 Pipes, Filters & Redirection (22 slides)21

22 END OF PIPES, FILTERS, AND REDIRECTION


Download ppt "PIPES, FILTERS, AND REDIRECTION Additional Adds by David Sims."

Similar presentations


Ads by Google