Friday, February 27, 2009

Chapter 5 Review Questions

1.) A regular expression is used to:

Define a potentially complex pattern of characters or digits.

2.) The regular expression [cChapter0[12345]* does not match which of the following files?

Chapter1.doc

3.) Which of the following regular expressions matches the text "Reunion-2004"?

Reunion-[0-9]{4}

4.) The grep command is not useful for which of the following?

Determining which directories are currently in use.

5.) Searching documents created by word-processing programs is not an appropriate use of the grep command because:

Word-processing documents contain nonreadable codes (nontext information).

6.) If you execute a grep command without providing the name of one or more files to search, you should:

Provide input using a pipe from another utility.

7.) You need to track the output of a text file in real time as lines are added to that file by another program. Which command do you use?

tail -f

8.) Several commands are available in Linux that let you compare two or more files to determine how they differ. One of these programs in particular is widely used by programmers and system administrators and is a tool commonly used for assisting with modified source code on Linux systems. Which is it?

diff

9.) Which of the following features is not supported by default in ispell?

Seeing a list of suggestion words to correct the spelling of a word that ispell does not recognize, then selecting one of those words to insert in the document by pressing a single key.

10.) The wc command displays:

The number of lines, words, and characters in a file.

11.) Name five programs that can be used to filter text files in Linux.

sort, diff, comp, sed, awk

12.) The command ls sort causes which of the following to occur?

The output of the ls command is sent to the sort command. The results are printed on the screen.

13.) When you run a program called gather_data, it normally reads text as a user enters it at the keyboard. If you use the command gather_data <> to run the program, which of the following occurs?

The input that the gather_data program normally reads from the keyboard is taken from the input_text file instead.

14.) Which independent Linux command replaces tabs in a text file with a fixed number of spaces?

expand

15.) The name of a script file can be provided to sed and awk on the command line using which command-line option?

/file name/

16.) Using a ! along with a standart write command in vi causes the editor to:

Attempt to write the file despite a file permission that does not by itself permit writing the file, though this can only be done if the person editing the file is the owner of that file or is working as root.

17.) Which of the following creates a mark at the current line within vi so that you can quickly jump to that line in the file?

'a

18.) The vi editor checks for an environment variable and for a hidden initialization file in the directory in which a file being edited is stored. These are called respectively:

EXINIT, .exrc

19.) Describe the meaning of 1,$ as a ranger operator at the beginning of a search and replace command withing vi.

It is telling the search command to search from line one of the document all the way to the end.

20.) Describe the difference between the following four search commands in vi: / ? n N

The / command tells vi to search from the current position forward. The ? command tells vi to search from the current position backward. The n command tells vi to move to the next position of the most recent / or ? command. The N command tells vi to move to the previous position of the most recent / or ? command.

No comments: