Working with Text Files
Download
Report
Transcript Working with Text Files
Operating Systems I
Using Text Editors
MCT260-Operating Systems I
Primary Learning Objective
Manipulate Text Files Using Built-in
Text Editors
MCT260-Operating Systems I
2
Specific Learning Objectives
• Identify and define the key terms used with text
editors
• Use text editors built into the operating system to
create text files
• Create a text file using the COPY CON command
• View a text file using the TYPE command
• Use redirection operators in CLI
MCT260-Operating Systems I
3
Text Files
• Letters and simple punctuation that makes
up words, sentences, and paragraphs.
• Typically in IT, the term text refers to text
stored as ASCII code (that is, without any
formatting).
• Objects that are not text include graphics,
numbers (if they're not stored as ASCII
characters, and program code.
MCT260-Operating Systems I
4
ASCII
• Stands for American Standard Code for
Information Interchange
• The original standard ASCII coding scheme
used 7 bits (128 characters) to represent all
upper &lower case letters, 0-9, punctuation,
and special control characters (See page 97)
• Extended ASCII uses 8 bits (256 characters)
added foreign-language, graphical &
scientific characters. ( É, û, ß, µ)
MCT260-Operating Systems I
5
Other Character Sets
• EBCDIC (pronounced "ehb-suh-dik" ) is a
binary code for alphabetic and numeric
characters that IBM developed for its larger
operating systems.
• ANSI’s first 128 characters are the same as
ASCII but the second 128 depends are the
language supported
• Unicode uses 16 bits (65,536 characters) of
which about 21,000 are Chinese ideographs
MCT260-Operating Systems I
6
Built-In Text Editors
• Notepad – Create or edit text files without
formatting. Used for batch files, in coding
HTML and other programming languages.
• MS-DOS Editor – Create or edit files using
the EDIT.COM command (actually a small
application). Uses similar to Notepad.
• COPY CON – Create but not edit small files.
• WordPad – Like MS Word it uses formatting
so the actual file size will be larger.
MCT260-Operating Systems I
7
Viewing Text Files from CLI
• Use MS-DOS Editor
• Use the TYPE command
MCT260-Operating Systems I
8
Using Redirection Operators
• In CLI, the OS expects input from the standard
input device or keyboard and sends or directs
output to the standard output device or monitor.
• To send output or input to/from a device other
than the standard one, you redirect or change the
destination/source with redirection operators
• Some of the redirection operators are output ( > ),
input ( < ), pipe ( | ), and appending ( >> )
MCT260-Operating Systems I
9
Output & Appending
Redirection Operators
• Output is the greater than symbol ( > )
• If you want to redirect output to a file/printer,
specify the name of the file or printer after the
symbol. If the filename exists, the file will be
overwritten.
dir > filename
dir > prn
• To append, to add to an existing file use ( >> ).
date >> filename
MCT260-Operating Systems I
10
Input Redirection Operator
• Although the OS expects the input to come
from the keyboard, it can come from a file
instead.
• Input is the less than symbol ( < )
• If you want to redirect input to a process or
command, specify the name of the file or
printer after the symbol.
Command < filename DEL One\*.* <
y.txt
MCT260-Operating Systems I
11
Piping Output to the MORE Filter
• A filter is a command that can modify the output
of another command. The MORE filter or
command is an external command that displays a
screen of output, pauses, and then displays “—
More—” which permits you to continue when
ready.
• The pipe operator ( | ) redirects the output
produced by one command so that the output then
becomes the input for another command.
[command] | MORE TYPE syllabus.txt |MORE
MCT260-Operating Systems I
12
Summary
•
•
•
•
•
Text Files
ASCII and other character sets
Built-In Text Editors
Viewing Text Files from CLI
Redirection Operators
MCT260-Operating Systems I
13
Homework Assignment
• Reading
– Windows XP Textbook – pp 86-87
– CLI Textbook - pp. 96-107, 114-116
• Lab Exercise 7: Text Files
• Due Date: A Week from Next Tuesday
MCT260-Operating Systems I
14