Networking Chapter 5 1 it is helpful to enter the character pattern you are trying to find in single or double quotes

subject Type Homework Help
subject Pages 7
subject Words 1079
subject Authors Michael Palmer

Unlock document.

This document is partially blurred.
Unlock all pages and 1 million more documents.
Get Access
page-pf1
CHAPTER 5: ADVANCED FILE PROCESSING
TRUE/FALSE
1. You can use the < operator to redirect a command’s output from the screen to a file.
2. You can use the less command with a directory to view its contents one screen at a time, such as less
/sbin.
3. The pipe operator can connect several commands on the same command line.
4. When using wc, you cannot specify all three options (-l, -w and -c) in the command line at the same
time.
5. A popular use of pr is to convert lowercase characters to uppercase characters.
6. You can use the vi editor to create script files.
MULTIPLE CHOICE
1. ____ is NOT a selection command.
a.
comm
c.
grep
b.
diff
d.
sed
2. ____ is a selection command.
a.
uniq
c.
sort
b.
awk
d.
sed
3. The ____ redirects the output of one command to the input of another command.
a.
output redirection operator (>)
c.
pipe operator (|)
b.
input redirection operator (<)
d.
tilde (~)
4. You use the ____ command to search for a specified pattern in a file, such as a particular word or
phrase.
a.
find
c.
sed
page-pf2
b.
grep
d.
diff
5. The ____ option of the grep command displays only lines that do not contain the search pattern.
a.
-v
c.
-o
b.
-n
d.
-r
6. The ____ command removes duplicate lines from a file.
a.
grep
c.
uniq
b.
dup
d.
diff
7. The ____ option of the uniq command instructs it to generate as output only the lines of the source file
that are not duplicated successively.
a.
-d
c.
-o
b.
-s
d.
-u
8. The ____ command locates identical lines within two identically sorted files.
a.
diff
c.
uniq
b.
sed
d.
comm
9. The ____ option of the diff command shows lines surrounding the line that differs.
a.
-d
c.
-c
b.
-D
d.
-C
10. The ____ option of the diff command does not compare for blank lines.
a.
-b
c.
-c
b.
-B
d.
-C
11. The ____ option of the diff command ignores blanks that repeat.
a.
-b
c.
-c
b.
-B
d.
-C
12. The ____ option of the diff command is used to display the differences side-by-side in columns.
a.
-s
c.
-n
b.
-c
d.
-y
13. To append new lines in sed, you must use the ____ command
a.
a\
c.
\a
b.
-a
d.
>a
page-pf3
14. By default, pr formats the specified files into single-column pages of ____ lines.
a.
22
c.
55
b.
33
d.
66
15. By default, each page in the output of pr has a ____-line header, which, by default, contains the
current file’s name, its last modification date, the current page, and a trailer consisting of blank lines.
a.
three
c.
five
b.
four
d.
six
16. ____ is a full-featured programming language.
a.
Sed
c.
Emacs
b.
Awk
d.
Grep
17. The ____ function within the awk command is used to format output.
a.
out
c.
print
b.
outln
d.
printf
18. When using the printf function, ____ indicates that the output is to appear in decimal digits.
a.
%i
c.
%d
b.
-i
d.
-d
19. You use the ____ character in script files to mark comments.
a.
tilde (~)
c.
pipe (|)
b.
dollar ($)
d.
pound (#)
20. Bash is a freeware derivative of the Bourne and ____ shells.
a.
Korn
c.
csh
b.
C
d.
tsh
21. When you create a shell script to run in Bash, you can immediately run the script by typing ____ and
then the name of the script.
a.
run
c.
start
b.
sh
d.
exec
22. One way to run a shell script is to make it executable by using the x permission and then typing ____
prior to the script name when you run the script itself.
a.
./
c.
.
b.
/.
d.
..
page-pf4
COMPLETION
1. ____________________ commands focus on extracting specific information from files, such as using
the comm command to compare file contents.
2. ____________________ and transformation commands alter and transform extracted information into
useful and appealing formats.
3. The sed editor is sometimes called a(n) ____________________ editor because input to sed is
rendered in standard output (to display on the screen).
4. The first task in the record design phase is to define the ____________________ in the records.
5. A shell script should contain not only the commands to execute, but also ____________________ to
identify and explain the shell script so that users or programmers other than the script’s author can
understand how it works.
ANS: comments
REF: 233
MATCHING
Match each command with a statement below.
a.
pr
f.
diff
b.
sed
g.
sort
c.
comm
h.
tr
d.
grep
i.
wc
e.
cut
1. compares sorted files and shows differences
2. selects lines or rows
3. counts characters, words, or lines in a file
4. selects columns (fields)
page-pf5
5. compares and selects differences in two files
6. formats and prints
7. edits data streams
8. sorts and merges multiple files
9. translates and deletes character by character
SHORT ANSWER
1. What will happen if you execute the following command?
ls -l /sbin | more
2. In some cases, when you use grep, it is helpful to enter the character pattern you are trying to find in
single or double quotes. Why?
3. What is the diff command used for?
4. What is the wc command used for?
page-pf6
5. What is the sed command designed for?
6. What is tr used for?
7. What is the pr command used for?
8. What is a record layout?
9. Indicate one advantage to using the Bash shell (instead of the Bourne shell) to run a shell script.
10. When you write a script, it is advisable to specify with what shell the script is intended to be used.
How can you do this?
page-pf7

Trusted by Thousands of
Students

Here are what students say about us.

Copyright ©2022 All rights reserved. | CoursePaper is not sponsored or endorsed by any college or university.