In this assignment, you will demonstrate some basic Unix commands by
performing some simple tasks. To begin this assignment,
look at the files located
~cs155/pub/hw2Files directory. The files contain
information about people. For each person there are four files.
For example, Sam would have the following four files:
Your primary objective in this assignment is to use your knowledge of Unix commands to collect and manipulate data contained in these files. For each of the problems listed below, you should give the command(s) you used. I want to see the commands, not the output of those commands.
Place your answers in a file named
simple, and submit it for HW2.
It must not be called “hw2”. You may use
nano to generate your
submission, or any other editor that you prefer. Your submission should
be formatted as follows, with blank lines between parts:
1 command command 2 command command 3 command 4 ... etc.
This time the grading is a little different: The difficulty of the questions vary. Some problems require multiple steps and some require complex commands. Each problem specifies a number of commands; you will be penalized for submitting an answer that uses more commands than were specified.
cat foo | cut -c' ' -f 2 | sort
cat foo; date
cat foo date
Unless otherwise specified, assume that you start this assignment in your home directory. Assume that after each question you return to your home directory. A few of these problems will require some thought. Try to break the problems into individual commands and test out your ideas before assembling commands together. Good luck.
substandardin your home directory that contains the file names and lines (the data, not the line numbers) in the grades files where students scored less than ten out of a hundred.
datain your home directory. Copy all
infofiles into this directory.
classesin your home directory with a list of all the classes taken by anyone (e.g. classes listed in all grades files). Look at the manual page for
cut, and be sure to use quotes on your delimiter.
classes, just display the results.
firein your home directory with a listing of all people who logged in on July 4th 2006.
.logfiles and search for anyone with an entry for the date specified.
cutcommand in more detail to get just the name.
log.infoin your home directory containing two columns, where the first column is the number of times the person has been logged and the second column is the person’s name (use
cutto remove the
.logfrom the output).
sortman pages for this problem.) The output looks like this:
1 jane 1 jill 1 matilda 1 mati 1 sally 1 sam 1 wilma 3 george 4 alex 5 fred 7 gerry 7 jack 11 mary 44 total
It doesn’t matter whether
matilda comes first.
manto get information on commands. Some problems require command options we may not have covered in depth during class.
~) and not some giant hideous path that starts with
/s/. If you use a giant hideous path instead of using tilde, you will lose points. This means that you have to use quotes properly. Consider this, which produces bad results in the file
x, and good results in the file
% echo Go home: cd ~ >x % echo "Go home: cd ~" >y % cat x Go home: cd /s/parsons/d/fac/applin % cat y Go home: cd ~
jack.log, it would not be acceptable to
cat jack.log, look at the results, count the lines on your fingers, and then turn in the command
echo 7. Yes, that command produces the same results, but that command doesn’t actually do the counting—you did.
~cs155/bin/checkin HW2 simple
Follow the directions on the homework page.
Turn in someone else’s work.
User: Guest                 Check: HTML CSS
Edit History Source
Apply to CSU |
Contact CSU |
Colorado State University, Fort Collins, CO 80523 USA
© 2015 Colorado State University