Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this assignment, you will demonstrate your ability to manipulate text files using common Unix commands and programs. A general hint about assignments in this

In this assignment, you will demonstrate your ability to manipulate text files using common Unix commands and programs. A general hint about assignments in this course: I try very hard to be sure that all of the commands, command options, and techniques that you need for each assignment are covered in the Lecture Notes and, even more specifically, that you will have practiced them in a Try This exercise. So, if you get stuck on an assignment, hunting through the Internet for obscure commands and command options is probably not the best use of your time. Go back to the Lecture Notes, especially the Try This exercises. And if your problem is that you did a Try This but did not understand the output that you observed, then you really should be asking questions about that exercise, before you move on to attempt this (or any other) assignment. For this assignment, you will need two sessions open (e.g., a pair of ssh sessions, or a pair of xterms), one for answering the questions, and one for experimenting with different commands to see if they represent the correct answer. When you are satisfied with one of your commands, copy and paste it from your experimental window into your question and answer window. In either window, create a directory ~/UnixCourse/commandsAsst. Use cd to make that new directory your current working directory (in both of your session windows). For the remainder of the assignment, you should not cd into a different directory. In one window, give the command ~cs252/bin/basicCommandsAsst to start the assignment. In each of the numbered questions below, you are asked for a single Unix command to achieve some goal. You will be typing that command into the assignment checker, just as you would type it into a shell to actually execute the command. Let me repeat the basic instructions, because the email Im getting seems to indicate that many, many people are ignoring it. Open a pair of windows, connected via ssh to one of the CS Dept Linux servers. Use one to supply answers to the questions listed below, but try your answers out first in the other window. If you enter a command that is incorrect, the grading script may attempt to offer a hint or two as to what you are doing wrong. These hints are often helpful, but can sometimes be irrelevant, particularly if you happen to come up with an approach to the problem that I had not anticipated. In an earlier assignment, you created a fileAsst directory. Some files have just been placed into that directory, some of which are text files (recognizable as such because their names end with .txt). Now these files are in your fileAsst directory, but your current working directory is the commandsAsst directory. Give a command to list the names of those text files, using an absolute path to the fileAsst directory as part of your command. Give a command to list the names of those same text files, using a relative path to the fileAsst directory as part of your command. The file /usr/share/dict/words contains a long list of words in the English language, one per line, arranged into alphabetical order. This file is normally used as the dictionary for spell checkers. Suppose you were working a word puzzle and needed a 5-letter word with a lower-case vowel (including y) in the second position, and ending with t. The remaining letters could be any character that occurs in English words, including upper and lower-case alphabetics, numbers, hyphens, etc. (We will accept the file /usr/share/dict/words as the authority on what constitutes a valid English word and what characters can appear within one.) What grep command would you use to list the words from /usr/share/dict/words that match this requirement? You are part of a team working on a large C++ program. The source code for this program is kept in the directory ~cs252/Assignments/commandsAsst/project. After a certain amount of debate, the team has decided to change the order of the parameters of the function binarySearch. Someone else is actually changing the definition of that function. Your job is to find all the places where that function is called and to make repairs as necessary. What command would you give to list all calls to that function? You should show the lines of code containing each call and the name of the file from in which each such line occurs. (Its OK to produce a few incidental uses of the function name as well, because you will be inspecting the output before actually making the changes.) Same problem, but suppose that all you wanted was a list of the source code file names in which the function was mentioned?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Secrets Of Analytical Leaders Insights From Information Insiders

Authors: Wayne Eckerson

1st Edition

1935504347, 9781935504344

More Books

Students also viewed these Databases questions