Please, in your mails, mention your regular e-mail address to which I can send my corrections.
Important remark for those who have already some previous knowledge of Unix: please use only the tools that we have learnt so far in your solutions, even if you can give another solution using a more advanced tool. But if you cannot give a solution with the easier tools that other people have learned so far, then this means that you can still improve your knowledge of Unix. If you use tools that were not mentioned in the course so far, you receive less points, because the ultimate goal of the exercises is not to have those problems solved, rather to practice the tools that are part of the curriculum. Using more advanced tools means that you are not familiar enough with the basic tools, or it means that you are too lazy to think more.
Using what we have learnt this week, give a command line that will return the long list of the sub-directories (the names of the directories) in your actual working directory. In other words: return only the blue lines (those are the subdirectories), when you type 'ls -l'.
Don't worry, if they are not blue anymore, as long as you list only directories and not regular files. What happens is that colouring takes place only if the output of 'ls' is directly the screen; but if you redirect the standard output (e.g. in a pipe line), the colours are lost.
Write a command line that returns you the number of files (and directories) in the given directory that are readable and executable, but not writable to the members of the group to which the file belongs.
The header of some of the Federalist Papers contains the date of the publication of the paper. For instance, fed29.txt was published on Thursday, January 10, 1788. Write a command line that counts how many of the Federalist Papers were published on Tuesday. Send me both the command line and the result.
Don't forget that a document can include the word "Tuesday" within the text, as well (fed7.txt actually does). So you want to check only the headers of the files, and not their full content. Another tip: first try to collect the lines containing "Tuesday", and only when this is done, go further to count the lines.
Imagine that you have a file "keyword" in your directory, and this file contains one word. You have an other file in your directory, which is named "file_name", and this contains also just one word, but this is the name of another file.
Write a command line that will go through the file that you specify in the file "file_name", and will return you only the lines containing the word that is in "keyword".
In other words, the files "keyword" and "file_name" behave as if they were variables: you always run the same "program" (command line in this case), and you can determine what exactly the program has to do by changing the values of its parameters (variables, in this case: the content of these two files).
What happens if one of these two files do not exist? What happens if one of these files exist, but contains nothing? Send me the command line and answer these questions.
Tip: to create the files "keyword" and "file_name" quickly, use something like:
echo Hamilton > keyword
echo /users1/birot/Federalist/fed74.txt > file_name