Answered step by step
Verified Expert Solution
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 review of CIS A
From the practice exercise, you should have already set up an easy way to copy files from the homedistributioncnguyencisb directory on voyager, without having to type the long path name every time.
If you are not already at your home directory, go to your home directory and dont change directory for the rest of this module lab. Show the absolute path of your current directory.
Use the set up from the practice exercise thats described above, copy the file labin from the cisb directory to your current directory.
Create a subdirectory called labdir and an empty file named f
Dont use a text editor, create a file called f in the directory labdir and put your user id login id and your current shell in file f You should not have to type in your user id or your current shell, let the system fill in these values. Don't forget that this step should be done on one command line, just like all the other steps.
Use the correct option of the ls utility to list files f f and labin where the size in bytes is shown. Only these files should be shown in the output.
For the next steps, use the file labin and use only the filters that are reviewed in Module lecture notes.
Dont use sed or awk, there will be plenty of opportunities for these utilities later.
labin is a text file with information on big US cities. Each line has fields: city name, high elevation, low elevation. The fields are separated by a semicolon.
Show how many cities there are in the file labin 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
Note that there is no filename in the output.
For the city with the highest high elevation, show the city name and its elevation only these fields should be in the output and the fields should be separated by a colon :
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.
Download the pseudocode at the link "Programming selftest".
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.
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 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 controlccommandc to copy your code of step and then use controlvcommandv 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 labtxt output file before continuing to module
Module regex egrep, find
Use the same labin file in Module for steps
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 labin:
Show all lines where the city name starts with 'San' uppercase or lowercase
Show all city names that have words in the name. Only the city names should be in the output.
Hint : both "los angeles" and "Washington DC have words, how do you determine when it's words?
Hint : make your regex as short as possible.
Show the count of cities where the high elevation is not in the hundreds or a digit number The output should be just a number.
Show the line numbers of cities where the low elevation is or at sea level. The output should be line numbers only.
Working with your current files:
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.
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 hours.
For your home directory and all its subdirectories, find all files with filenames that contain at least digit, and change their permission so only you have read and write access and everyone else has no access.
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started