If you didn't have time last week, try out pico and pine (2 points for last week, if you show us your surviving vi...).
You can try out 'joe', too. The key information to remember in 'joe'
is how to get help: it is by ^K H (type CTRL-K, release the CTRL-key, and
Introductory remarks about tr:
Werk efficient, anders kost het veel tijd:
In de bash-shell kun je eenvoudig een vorig commando ophalen met pijl-omhoog, en dan bijediten (nieuwe schrijversnaam invullen).
Een begin van een filenaam kan automatisch aangevuld worden door op TAB te drukken.
Tik commando's of resultaten niet over naar je antwoordfile maar copieer en plak (al ontdekt hoe dat simpel kan met 1e/2e muisknop?)
Met de pipe |less kun je output gedoseerd bekijken.
Assignments for this week (10 points):
Give a one-line (although complex) command that gives you the first five people who have logged in. Hint: there is a command that gives you the list of people who are logged in into the system. Send this command to Mariette. (1 point)
(Imagine you were on a big machine, having really more than one user
in the same time... On Linux you can simulate this situation by opening
either new terminals, or to log in using the non-graphical virtual terminals,
Sort the list of your directory according to the size of the files (there
are several solutions...). Send the one-line command doing this to Mariette.
From now on we will work with the Federalist Papers. For more information about this project by George Welling see: USA project and also this side.
You will find the files you need for the assignments uned: ' /users1/birot/Federalist '.
Read the README file in this directory.
Get a list of these, and look at the content of some of them (using cat, more or less).
Try editing one of them, making some changes, using pico ('pico /users1/birot/Federalist/fed1.txt'). Try saving it (under the same name). Why doesn't it work? Save it under a different name.
Can you change the permissions of it?
Save it to your directory, try editing it, and save it under this name.
Send Mariette the file fed1.txt (as
an attachment!), after you have added to it the translation of the
first sentence, delete the major part of the text (starting with the third
paragraph: "Among the most formidable..."), as well as write the answer
to the previous question into this file, including the command changing
the permission. (1 point)
In fed84.txt there are many numbers. Imagine you want to hide them for
some reasons (let's say because that's a secret document), so you want
to put stars instead of them. How would you do that? Send the command line
to Mariette. (1 point)
Can you get the number of words appearing in the articles written by
James Madison with a simple command? Send the command line with the result
to Mariette. (1 point)
Concatenate the headers (the first 6 lines) of all the federalist papers
by Alexander Hamilton (read the README file) into one file, and send the
command to Mariette. (1 point)
Send Mariette a command line that counts the number of words in the lines 5-15 (van 5 t/m 15) of its input. If no other input is specified, the input should be the standard input.
Give the command line that prints the following text to your neighbours screen:
I love you, my dear ..
Where do you get information about your neighbour's screen from? (About people logged in in general?) Check also the manual of the command called 'tty'. Solutions to be sent to Mariette.
(Remark: on Linux your neighbour is in fact another terminal or a virtual terminal you open. See the remarks to exercise no. 1.)
Extra work, for experts only (no extra points, but extra fun and extra experience...):
Suppose you are in the directory where you can find all these files. Find out what the following command-lines do:
(echo 'scale=4';(ls fed* | wc -l ; echo "/" ; ls | wc -l) | tr -d "\012"; echo) | bc
(echo 'scale=4';(cat fed* | wc -c ; echo "/" ; cat [dfjm]* | wc -c) | tr -d "\012"; echo) | bc
Try playing around with them, using only a part of them. Understand why do you need the last 'echo'.
What about changing -c to -w as the option of the wc command? (Send
the answer to Tamas.)