Presentation is loading. Please wait.

Presentation is loading. Please wait.

Command Prompt Chapter 9 Pipes, Filters, and Redirection ©Richard Goldman 11/30/2000 Revised 10/16/2001.

Similar presentations


Presentation on theme: "Command Prompt Chapter 9 Pipes, Filters, and Redirection ©Richard Goldman 11/30/2000 Revised 10/16/2001."— Presentation transcript:

1

2 Command Prompt Chapter 9 Pipes, Filters, and Redirection ©Richard Goldman 11/30/2000 Revised 10/16/2001

3 Pipes ( | ) Pipes are used to pass information from one command (or filter) to another command. The pipe stores the output form one command in a temporary file and then passes it to the next command. DIR | SORT

4 Filters FIND – Searches for a character string SORT – Arranges lines in order MORE – Displays one screen at a time.

5 FIND Use to locate a text string within a text file. Example: FIND “Goldman” Names.FIL FIND is case sensitive unless you use /I

6 SORT – from Keyboard Sorts input form the keyboard and displays the output on the screen. Press F6 after last entry to execute the sort. Uses ASCII sort sequence. –Punctuation –Numbers –Uppercase Letters –Lowercase Letters

7 SORT – from a File Example: SORT Names.txt (Output to screen) SORT Names.txt > New.txt (Output to file) Uses ASCII sort sequence. –Punctuation –Numbers –Uppercase Letters –Lowercase Letters Can add /+n to start sort at a different column. –(column = the number of characters from the left.) Can add /R (Reverse) for descending sort.

8 MORE Command MORE allows one screen of data to be displayed at a time. Example: DIR | SORT | MORE MORE can also be used by itself to display the contents of a file one page at a time. (Acts like the TYPE command with page brakes) MORE < Names.fil MORE may also be used without input redirection MORE Names.fil

9 Redirection > Redirects output to other device or file. < Redirects input from other device or file. >> Redirect output to append to a file.

10 Redirect Output Can only be used to change output from the standard output device (monitor). Example: DIR > PRN

11 Redirect Input Can only be used to redirect input from standard input device (keyboard). –(Remember that the SORT command, by default, looks to the keyboard for input.) Example: SORT < Mydir.txt

12 Example: SORT with Redirection from a File and Redirection to a file. SORT New.txt This will sort the contents of a file (Names.txt) and send the results to a file (New.txt). Sort may also be used without input redirection SORT Names.txt > New.txt

13 Example: SORT with Redirection from a File and Redirection to the Printer SORT PRN This will sort the contents of a file (Names.txt) and send the results to the printer.

14 Example: SORT with Redirection from a Directory and Redirection to a file SORT New.txt This will sort the contents of the current directory and send the results to a file (New.txt).

15 Append (>>) Adds to the end of a file. Note: There is NO space between the two >> characters. Example: DIR >> Ourfile.txt TYPE > Yourfile.txt >> Ourfile.txt DO NOT FORGET!!!!! –Note: There is NO space between the two >> characters. If you forget and put a space between them, the computer will interpret it as a redirection not an append.(Redirection will replace everything with the new data – not append to it.)

16 Using Filters and Redirection Example: DIR | FIND “CA” | SORT > PRN –Use pipes when passing data from command to command. –Use redirection when changing the standard input or output device.

17 End


Download ppt "Command Prompt Chapter 9 Pipes, Filters, and Redirection ©Richard Goldman 11/30/2000 Revised 10/16/2001."

Similar presentations


Ads by Google