Download presentation
Presentation is loading. Please wait.
Published byEdwin Elliott Modified over 9 years ago
1
Creating a new ASCII file Output usually goes to screen Output can be redirected to a file using the output redirection operator > (greater than symbol) > (greater than symbol)
2
Syntax to Create an ASCII File Syntax: [command] > filename Example: dir > classfile.txt Note: If the filename already exists, the file will be OVERWRITTEN. Output redirection symbol
3
Appending to an Existing ASCII file Instead of overwriting a file, the new information can be added to the end of the existing file. Syntax: [command] >> filename Example: dir a: >> classfile.txt dir a: >> classfile.txt
4
View an ASCII file The contents of a file can be viewed from the command prompt using the TYPE command. Syntax: TYPE filename Examples: TYPE mypoem.txt TYPE A:\Abc\mypoem.txt TYPE A:\Abc\mypoem.txt > PRN TYPE A:\mypoem.txt > A:\poemcopy.txt
5
PRACTICE-TYPE Type in the following: A: A: DIR DIR DIR > classfile.txt DIR > classfile.txt TYPE classfile.txt TYPE classfile.txt DIR r* DIR r* DIR r* >> classfile.txt DIR r* >> classfile.txt TYPE classfile.txt TYPE classfile.txt (in a minute we will learn how to prevent the display from scrolling off the page)
6
Using Redirect to Print Output can be redirected to a printer Syntax: [command] > printer port [command] > printer portExamples: dir a: > PRN dir a: > LPT1
7
PIPING and FILTERS The PIPE operator redirects the output of one DOS command to another command. It looks like this: | A FILTER is a DOS command that can modify the output of another DOS command. They are: MORE MORE SORT SORT FIND FIND
8
Input and the MORE filter Input does not have to come from the keyboard Input can come from a file instead The MORE filter can take this input and alter the output T he filter MORE displays a text file a page at a time on the computer screen Syntax: [command] | MORE Example: TYPE A:\programmer.txt | MORE TYPE A:\programmer.txt | MORE
9
Redirecting Input Using an ASCII Text File Windows XP lets you use MORE in another way Syntax: MORE < filename MORE < filenameExample: MORE < SomeFile.txt MORE < SomeFile.txt
10
Yet Another Way to Use MORE In Windows XP, MORE can be used the same way as TYPE Syntax: MORE filename MORE filenameExample: MORE A:\resume1.txt MORE A:\resume1.txt
11
Recap of the MORE filter In Windows XP, you can get the same results by typing in each of the following: Type classfile.txt | More More < classfile.txt More classfile.txt
12
Practice MORE Type in the following: TYPE classfile.txt TYPE classfile.txt | MORE MORE < classfile.txt MORE classfile.txt
13
Sorting ASCII Text Files The content of an ASCII file can be sorted before it is displayed. The SORT filter accepts the input and sorts it before it is displayed. Syntax: SORT < filename Example: SORT < classfile.txt
14
SORT syntax without redirect SORT syntax without redirect The SORT can be used without redirecting input. Syntax: SORT filename Example: SORT classfile.txt SORT classfile.txt
15
Reversing the Sort Order The SORT order can be reversed. Syntax: SORT /R < filename or SORT /R filename Examples: SORT /R < classfile.txt or SORT /R classfile.txt
16
PRACTICE-SORT Type in the following: SORT classfile.txt SORT classfile.txt SORT /R classfile.txt SORT /R classfile.txt
17
Searching the Contents of an ASCII File The FIND filter allows you to find information in a file SYNTAX: FIND “string” filename EXAMPLE: FIND “04” classfile.txt
18
FIND and IGNORE CASE switch To have the command “ignore case” add the ignore switch SYNTAX: FIND /I “string” filename EXAMPLE: FIND /I “DOG” classfile.txt
19
PRACTICE-SORT Type in the following: FIND “04” classfile.txt FIND “04” classfile.txt FIND “file” classfile.txt FIND “file” classfile.txt FIND “file” /i classfile.txt FIND “file” /i classfile.txt FIND “an” classfile.txt FIND “an” classfile.txt FIND “an” classfile.txt /i FIND “an” classfile.txt /i
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.