Question
LINUX PLEASE!!! Module 4: awk All steps should be done using one command line and the awk utility. Don't use any other filter such as
LINUX PLEASE!!!
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, grep, etc. 8. Use data from the /etc/passwd file, print the count of student accounts and the count of staff accounts. Make sure to print a text string to explain the 2 counts, dont just print the 2 numbers. Hint: student accounts have the word student on the line in the /etc/passwd file, and staff accounts have the word staff on the line. 9. Using data from the /etc/passwd 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 /etc/passwd file, N is the line number that contains your information, and M is the total number of lines. 10. Using data from lab3in, print the continent name and the population density of the continent with the highest population density, in the format: CONTINENT has the highest density of DENSITY where CONTINENT is the actual continent name from lab3in, and DENSITY is the actual density value from lab3in.
11. 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: 1 user logging in more than once or 3 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 1 user or no user, but there is 's' when its i2 or more users. This seems like a requirement for an English class, but it's actually to practice using a programming construct in awk. 12. Use data from the /etc/passwd file, print the count of each type of shell that are used in the system. The shell type is the last 'word' in field 7 of the file. Example: field 7 for the line with your user id is /bin/bash, so bash is your shell type. Example output: tcsh 1 shutdown 1 nologin 47 halt 1 helloaccount 1 bash 433 zsh 1 sync 1 csh 1 Extra credit (2pts): Some of the shell types shown above are not actual Linux shells, theyre system processes. The shell types are the ones ending with sh. For 2 pts EC, Instead of printing the output above, add to your awk script so it only prints the actual shell types and the count. Example output: tcsh 1 bash 433 zsh 1 csh 1
FILE:
Continent;Area(sq. mi);Density(People per sq. mi)
Africa;11,730,000;87.15 Asia;16,920,000;246.11 Australia;3,478,200;8.37 Europe;3,930,000;187.84 North America;9,460,000;57.29 South America;6,890,000;56.90
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