Awk
For this assignment, use awk to answer the questions.
Three files are referred to:
- words file /usr/share/dict/words,
- cars file from class
the cars file is linked here, but keep in mind that it
is tab delimited
- the password file
Create a shell script of echos and awk
commands that
resembles this:
echo "Your name"
echo "1. awk ......"
awk ........
for each of the following:
- Use awk to display all words in the words file that contain an "zzan". Pipe the output through head
- Use awk to display the
words that start with a lower case vowel and end with "orch" or "urch".
Pipe the output through head
- Display the entire record of all cars that have an "o" in the first
column
- Display the car make and type for each car whose 4th column
is more than 45
- Display the car make and type for each car whose 5th column is in the range of $2000 to $4000 inclusive
- Display the records from the first plymouth to the first ford
- Display the records from the cars file where
column 2 has four or more letters in it.
- Display the sum of the costs of all the cars
- Print the TOTAL number of fields in the password file
- Print the TOTAL number of records in the password file
Note: You can combine the last two problems into 1 piece of code
To hand it in:
- Call your script assign9
- Capture the output of assign9 and call the output assign9.out.
- Place both assign9 and the output (assign9.out) in your obsidian dropbox