3. Answer the following questions using the awk utility. Use the file named hw1_
ID: 3666556 • Letter: 3
Question
3. Answer the following questions using the awk utility. Use the file named hw1_q3data.txt for all the following questions.
a. Give the full awk command to print the full information of the players who have played 161 games.
b. Give the full awk command to print only the team Names of the players who have played 158 games.
c. Give the full awk command to print only the players who have scored less than 90 runs. This command should print the player’s name and the runs scored.
d. Give the full awk command to print the total number of runs scored by all the players
e. Write an awk program named hw1_q3e.awk which displays the following output.
$ awk -f hw1_q3e.awk hw1_q3data.txt
------Home Runs Data:------
Players who played 155 games: 2
Total Home Runs: 39
Players who played 158 games: 4
Total Home Runs: 98
Players who played 161 games: 3
Total Home Runs: 52
4. Write a script named hw1_q4.sed which uses the sed utility to make the following changes to any .c or .cpp program. Finally give the command to execute this script on a file named hello.cpp.
a. remove all comments (//, /*, */) from a .c or .cpp program.
b. remove any leading blank spaces from all lines of the program.
c. and then comment all the output statements (cout and printf).
Explanation / Answer
Answer 4:
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.