Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Module 1 ( review of CIS 1 8 A ) From the practice exercise, you should have already set up an easy way to copy

Module 1(review of CIS 18A)
From the practice exercise, you should have already set up an easy way to copy files from the /home/distribution/cnguyen/cis18b directory on voyager, without having to type the long path name every time.
1. If you are not already at your home directory, go to your home directory and dont change directory for the rest of this module 1 lab. Show the absolute path of your current directory.
2. Use the set up from the practice exercise thats described above, copy the file lab1-2in from the cis18b directory to your current directory.
3. Create a subdirectory called lab1-2dir and an empty file named f1.
4. Dont use a text editor, create a file called f2 in the directory lab1-2dir and put your user id (login id) and your current shell in file f2. You should not have to type in your user id or your current shell, let the system fill in these 2 values. Don't forget that this step should be done on one command line, just like all the other steps.
5. Use the correct option of the ls utility to list files f1, f2, and lab1-2in, where the size in bytes is shown. Only these 2 files should be shown in the output.
For the next 3 steps, use the file lab1-2in and use only the filters that are reviewed in Module 1 lecture notes.
Dont use sed or awk, there will be plenty of opportunities for these utilities later.
lab1-2in is a text file with information on big US cities. Each line has 3 fields: city name, high elevation, low elevation. The fields are separated by a semicolon.
6. Show how many cities there are in the file lab1-2in. Use a utility to count the cities, you should not have to do the counting. The output should be one line, with a text explanation, such as: Number of big cities is 50
Note that there is no filename in the output.
7. For the city with the highest high elevation, show the city name and its elevation (only these 2 fields should be in the output) and the 2 fields should be separated by a colon (:).
8. Show the city name of all cities with a low elevation below sea level (a negative value). The output should only be the city names. (Hint: use a regex to describe a negative number. You should not have to search through the file yourself for negative numbers to print the city names.)
In the following step you confirm that you have the basic programming skills needed for this class.
9. Download the pseudocode at the link "Programming self-test".
Use any programming language you like, write code to implement the pseudocode in a text file. The code doesn't have to have perfect syntax, but you should show the language construct to do looping, if statement, array, etc.
10. If you've been copying and pasting the command lines and output to an output file on your computer, then copy and paste the code of step 9 into your output file.
If youve been using the script utility to record all screen output, then stop the script recording. Next, use vim to open a text file and go to insert mode. Then use control-c/command-c to copy your code of step 9 and then use control-v/command-v to paste the code into the vim file and save it. Append the vim file to your script output file so the code is in your output file.
Save the lab1-2.txt output file before continuing to module 2.
Module 2(regex, egrep, find)
- Use the same lab1-2in file in Module 1 for steps 1-5
- Take advantage of options of the utilities to simplify your regex and your command line
- Don't use sed or awk
- All steps in this lab should be done with one command line per step, with no temporary files.
For all lines in lab1-2in:
1. Show all lines where the city name starts with 'San' (uppercase or lowercase).
2. Show all city names that have 2 words in the name. Only the city names should be in the output.
Hint 1: both "los angeles" and "Washington D.C." have 2 words, how do you determine when it's 2 words?
Hint 2: make your regex as short as possible.
3. Show the count of cities where the high elevation is not in the hundreds (or a 3-digit number). The output should be just a number.
4. Show the line numbers of cities where the low elevation is 0 or at sea level. The output should be line numbers only.
Working with your current files:
5. Show the filename of all files in your home directory and all subdirectories, where the file content contains semicolons. Note that its the file content, not the filenames, that contains semicolons. The output should just be the filenames.
6. Show the long listing of all regular files in your home directory (only your home directory, not subdirectories) that have a modified time of more than 2 hours.
7. For your home directory and all its subdirectories, find all files with filenames that contain at least 1 digit, and change their permission so only you have read and write access and everyone else has no access.
8. For your home directory and all its subdirectories, find all regular files that are empty and delete them, using the

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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

What are the steps in the T&D process?

Answered: 1 week ago

Question

Define training and development.

Answered: 1 week ago