Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Module 4 : awk All steps should be done using one command line and the awk utility. Don't use any other filter such as cut,
Module : awk
All steps should be done using one command line and the awk utility. Don't use any other filter such as cut, grep, etc.
Comparing awk with sed by doing the same first steps but using awk:
Without naming the continent, write an awk command line that has the same output as:
head labin tail
Without using line numbers, write an awk command line that has the same output as: grep America labin
Without using line numbers, write an awk command line that has the same output as: wc l labin
Without using line numbers, write an awk command line that has the same output as: grep v $ labin
Without using line numbers, print only the lines with continent data, indenting each line by spaces.
Without using line numbers, print the continent names and areas, separated by colon :
Only the continent names and their areas should be printed.
Comparing your answers above between sed and awk, you can see that sometimes the sed command line is
shorter, and sometimes awk is shorter.
a Use the echo command to show which step is shorter with sed, and which steps are shorter with awk
b It would be difficult to do all of step of Lab with awk.
Use the echo command to show which part of step of module lab is difficult to do with awk.
Now we look at more complicated tasks where awk would be simpler to use than sed.
For the steps below youll write awk scripts.
To document each step in your answer file:
If you use the script utility to record your answer:
Use the cat command to display your awk script
Then run the awk script to produce the output
If you dont use the script utility to record your answer:
copy your awk script to the output file
run the awk script to produce the output
copy and paste both the awk command line and the output
Using data from the etcpasswd file, print the following information about yourself, with a text explanation:
User FULL NAME is on line N out of M lines
where FULL NAME is your name as it appears in the etcpasswd file, N is the line number that contains your
information, and M is the total number of lines.
Print the name of the file in the root directory that has the largest size.
Start from the who command output dont use any option of who print the number of users who log in more than
once. When printing the number, print an explanation text that corresponds to the number of users.
Example output: user logging in more than once
or users logging in more than once
or no user logging in more than once
Note that there is no s after 'user' when it's user or no user, but there is s when its or more users.
Note also that no user must be printed, not user
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started