CHAPTER OUTLINETEACHING SUGGESTIONSREDIRECTION OF STANDARD I/O (INPUT/OUTPUT)ACTIVITY—USING > TO REDIRECT STANDARD OUTPUTACTIVITY—USING < TO REDIRECT STANDARD INPUTACTIVITY—USING >> TO ADD REDIRECTED OUTPUT TO A FILEFILTERSTHE SORT COMMANDACTIVITY—USING SORTFILTERS AND REDIRECTIONACTIVITY—USING THE SORT COMMAND WITH REDIRECTIONACTIVITY—USING THE FIND FILTERPIPESTHE MORE FILTERACTIVITY—USING THE MORE FILTEROTHER FEATURES OF MOREACTIVITY—USING THE EXTENDED FEATURES OF MORECOMBINING COMMANDS WITH PIPES AND FILTERSACTIVITY—COMBINING COMMANDSInstructor: Prof. Michael P. Harris Chapter 9ITSC 1405 – Intro to PC Operating Systems Pipes, Filters, and RedirectionChapter 9Pipes, Filters, and RedirectionLECTURE NOTESCHAPTER OUTLINE TEACHING SUGGESTIONSChapter Overview- Will use redirection to redirect standard input and standard output.- Learn how pipes can be used to connect programs.- How filters can be used to manipulate data will be explained.- What shell extensions are and how they may be used will be discussed.- Learn how to combine commands using pipes, filters, and redirection.REDIRECTION OF STANDARD I/O (INPUT/OUTPUT)- Redirection of Standard I/O (Input/Output)- What is keyed in is input.- What is written to screen is output.- Input/output called I/O.- OS recognizes three standards:- Standard input: Keyboard.- Standard output: Screen.- Standard error: place from which OS writes error messages to the screen.- Not all commands deal with standard input and standard output.- See PowerPoint slide #10 – Results of Copy Command- I/O redirection allows standard I/O to be changed.- Read from file, not keyboard.- Write to printer, not screen.- Three redirection operators.- The > redirects output of command to- Slides 2-6 Chapter Overview duplicated in PowerPoint slides. After completion of lecture, suggest to students that they review Objectives and Outcomes found on first page of chapter as acheck to see if they have mastered concepts.SECTION 9.1 (pp. 440-441)- Slides 7-13- Discussion Question (1) - Explain redirection.- Discussion Question (2) - Explain the terms standard input, standard output, and standard error.- Discussion Question (3) - Does every operating system command use standard input and standard output? If not, why not?- Discussion Question (4) - What is the differencebetween > and >> when redirecting output?- Discussion Question (5) - Explain how the symbol < is used.Carolyn Z. Gillay, Bette A. Peat, Windows XP Command Line Page 1Franklin, Beedle & Associates ©2003 ISBN: 1-887902-82-1Instructor: Prof. Michael P. Harris Chapter 9ITSC 1405 – Intro to PC Operating Systems Pipes, Filters, and Redirectiondevice or file.- The < asks for input from source other than the keyboard.- The >> redirects standard output and appends but does not overwrite a file.ACTIVITY—USING > TO REDIRECT STANDARD OUTPUT- Using > to Redirect Standard Output- DATA disk in Drive A, A: \> displayed.- Activity steps.- Key in:- DIR C:\WUGXP\*.TXT- DIR C:\WUGXP\*.TXT > TXTFILES.TXT- TYPE TXTFILES.TXT- Activity completed.ACTIVITY—USING < TO REDIRECT STANDARD INPUT- Using < to Redirect Standard Input- DATA disk in Drive A, A: \> displayed.- Activity steps.- Key in: - MD TEST - COPY C:\WUGXP\*.NEW TEST- DEL TEST\*.* - N then DIR TEST- TYPE Y.FIL- DEL TEST\*.* < Y.FIL- DIR TEST- Activity completed.ACTIVITY—USING >> TO ADD REDIRECTED OUTPUT TO A FILE- Using >> to Add Redirected Output to a File- DATA disk in Drive A, A: \> displayed.- Activity steps.- Key in:SECTION 9.2 (pp. 441-443)- Slide 14 Redirection is either/or process - See on screen, or prints to printer. Redirection can be used with commands thatwrites its results to standard output device (screen). Cannot use COPY DIR *.TXT - COPY copies files, not commands.- Discussion Question (6) – Keying in COPY DIR filename will not give you a file containing the directory display. Why?SECTION 9.3 (pp. 443-445)- Slide 15 DEL *.* needs keyboard response. Useful to lock up the system - i.e., write a file with X <Enter>, then write command as DEL \TEST\*.* < X.FIL. System will lock up. Be careful with redirection of input. - Tell OS to take input from a file; any keyboard input will be ignored..SECTION 9.4 (pp. 445-447)- Slide 16Carolyn Z. Gillay, Bette A. Peat, Windows XP Command Line Page 2Franklin, Beedle & Associates ©2003 ISBN: 1-887902-82-1Instructor: Prof. Michael P. Harris Chapter 9ITSC 1405 – Intro to PC Operating Systems Pipes, Filters, and Redirection- COPY C:\WUGXP\*.TXT- TYPE JUPITER.TXT- TYPE MERCURY.TXT- TYPE MERCURY.TXT >> JUPITER.TXT- TYPE JUPITER.TXT- Activity completed.FILTERS- Filters- Manipulate information.- Read information from keyboard.- Change input in specified way.- Write results to the screen.- Three OS filters - external commands.- SORT - arranges lines in ascending or descending order.- FIND - searches for particular group of characters, called a character string.- MORE - temporarily halts screen display after each screenful.- OS creates temporary files while it "filters" data.- Important that there be access to the disk and the filters.- If a disk is write-protected, the OS will not be able to execute filter commands.THE SORT COMMAND- The SORT Command- Sorts/arranges lines of text.- Sends output to screen unless redirected.- Default sorts in ascending order.- SORT syntax: See PowerPoint slide #22.- /R - reverses sort order- sorts Z to A, 9 to 0.- /+n - sorts file according to charactersin column n.- M kilobytes – amount of main memory to use for sort- /T – (Temporary) – path of directory to hold sort’s working storage in case does not fit into main memory. Can only use >>. There is no <<. >> between files – adds contents of first file to end of second file. To append to end of existing file, use doubleredirection symbol (>>)SECTION 9.5 (p. 447)- Slides 17-20 Compare filters to filters in water purification system.- Extract unwanted elements.- Send pure water on its way.- Discussion Question (7) - What are filters?SECTION 9.6 (p. 447)- Slides 21-22 Sorts A to Z or from lowest to highest numbers (starting in first column).- Discussion Question (8) – What do the three SORT parameters covered in this chapter—/n, /O, and /R—represent?Carolyn Z. Gillay, Bette A. Peat, Windows XP Command Line Page 3Franklin, Beedle & Associates ©2003 ISBN: 1-887902-82-1Instructor: Prof. Michael P. Harris Chapter 9ITSC 1405 – Intro to PC Operating Systems
View Full Document