Question
Task 06 (5 points) Write an awk script that will output the line numbers of each record that has less than or equal to 4
Task 06 (5 points)
Write an awk script that will output the line numbers of each record that has less than or equal to 4 fields.
Input file (hw0405.csv) | Example output |
1,3,5,8,10,11,54 1,2,3,4 15,18,21,42,37 1,1,1,0,0,3,16 4,1,8,0,4,6,13,16,17,20,8,6,4 13 | 2 6 |
Task 07 (5 points)
Write an awk script that will output the most popular dog breed based on number of votes using the information from the following entirely unbiased survey
Input file (hw0407.csv) | Example output |
Breed, Votes Black Lab, 30 Chihuahua, 2 Pug, 1 Corgi, 45 Shar Pei, 21 Shih Tzu, 5 Maltese, 7 | Corgi has 45 votes |
Task 08 (5 points)
Write an awk script that will output the records that contain only letters.
Input file (hw0408.csv) | Example output |
Avengers: Endgame Star Wars: Episode 7 - The Force Awakens The Great Gatsby Furious 7 Avengers: Infinity War Frozen 2 Harry Potter and the Deathly Hallows: Part 2 Lion King 1 The Fate of the Furious Minions Iron Man 3 | Avengers: Endgame The Great Gatsby Avengers: Infinity War The Fate of the Furious Minions |
Task 09 (5 points)
Write an awk script that will output the sum of all the sales figures.
Input file (hw0409.csv) | Example output |
Name,Emp ID,Sales,Dept,Resi Andrew,24,88,Eng,Y Brandon,66,14,Mkt,Y Chelsey,8,,Eng,N Deborah,38,,Ift,Y Erik,32,13,Mkt,N Arielle,13,48,Eng,N Shaun,55,78,Ift,N Ninette,3,24,Opr,Y Nguyen,10,54,Eng,Y | SUM: 319 |
Task 10 (5 points)
Write an awk script that will output the average of all the sales figures.
Input file (hw0409.csv) | Example output |
Name,Emp ID,Sales,Dept,Resi Andrew,24,88,Eng,Y Brandon,66,14,Mkt,Y Chelsey,8,,Eng,N Deborah,38,,Ift,Y Erik,32,13,Mkt,N Arielle,13,48,Eng,N Shaun,55,78,Ift,N Ninette,3,24,Opr,Y Nguyen,10,54,Eng,Y | AVG: 35.4444 |
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