Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need some assistance with this. #Write an awk script that will output the line numbers of each record that has less than or equal to

Need some assistance with this.

#Write an awk script that will output the line numbers of each record that has less than or equal to 4 fields:

Input file:

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

Output expected:

2

6

#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:

Breed, Votes

Black Lab, 30

Chihuahua, 2

Pug, 1

Corgi, 45

Shar Pei, 21

Shih Tzu, 5

Maltese, 7

Output expected:

Corgi has 45 votes

#Write an awk script that will output the records that contain only letters.

Input file:

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

Output expected:

Avengers: Endgame

The Great Gatsby

Avengers: Infinity War

The Fate of the Furious

Minions

#Write an awk script that will output the sum of all the sales figures.

Input file:

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

Output Expected:

SUM: 319

#Write an awk script that will output the average of all the sales figures.

Input file:

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

Output expected:

AVG: 35.4444

***expected execution: