Starting from:

$29

Homework 2 Fun with grep and find

UNIX System Programming Homework 2
Fun with grep and find. Store your answers in a textfile
1. Write a grep command that will match all words in a file that have at least one 'a'. 2. Write a grep command that will match all words in a file that have exactly one 'a'. 3. Write a single command line using only grep (perhaps multiple times) that will match all words in a file containing at least one occurrence of the vowels 'a', 'e', 'i', 'o', and 'u', in any order. E.g., unquestionable. 4. Write a single command line using only grep (perhaps multiple times) that will find all the words in a file containing at least one occurrence of the vowels 'a', 'e', 'i', 'o', and 'u', appearing in that order. E.g., unfacetious. 5. Write a single command line using only grep (perhaps multiple times) that will find all the words in a file containing exactly one occurrence of the vowels 'a', 'e', 'i', 'o', and 'u', in any order. E.g., unsportsmanlike. 6. Write a single command line using only grep (perhaps multiple times) that will find all the words in a file containing exactly one occurrence of the vowels 'a', 'e', 'i', 'o', and 'u', in that order. E.g., facetious. 7. Write a find command that will list all the files in your current directory (and its subdirectories) with the '.o' extension. 8. Write a find command that will list all the files in your current directory (and its subdirectories) that are larger than 50KB in size. 9. Write a find command that will list all the files in your home directory that are larger than 50 KB with the '.o' extension 10.Write a find command that will delete all the '.o' files that are larger than 50 KB in your home directory (and its subdirectories) that were accessed last more than 7 days ago. Notes: 1. You should assume that the grep commands are used on a file with one word on each line all in lowercase. You can test your commands using /usr/share/dict/words on a Linux box (after you test it on a much smaller file). 2. You can use dd if=/dev/urandom of=<filename.o bs=1k count=<numBlocks to create random '.o' files. You can modify access times with the touch command (see man page on how to change times other than modification time).

More products