Hall H.

asked • 02/11/21

computer science question

  1. Create this sample file, you can call it student grades

Name   3.54   ECE

Name    3.71   ECE

Name        2.63   CS

Name   3.74   MBA

Name     3.68   ECE

Name      3.06   SS

Name    2.34   CS

Name     2.77   CS

Name     4.00   ECE

Name   2.68   ECE

Name   3.56   EE

Name   3.81   ECE

Name     2.77   SS

Name    3.00   CS

Name      2.64   EE

Name     3.36   ECE

Name   3.31   EECS

Name    3.87   ECE

Name   3.75   EECS

Name     3.06   CS

Name     3.74   EE

Name    2.54   SS

Name     3.98   EECS

2.Create sample files lab1, lab2, lab3 and lab4. They can be created using vi, or doing something like who > lab1, etc. Once you have created the file, display its content with the cat command. Show your session.

Combine the lab files: lab1, lab2, lab3, and lab4 appending them >> to a file called all.labs . Any errors (pretend one of those lab files do not exist) should be redirected to an error.log file. Since you will have all the files, once you redirect the error 2>, assume that you do not have one of the files that consequently would generate an error, in this case the error.log file will be empty, but to build the command include the 2> as if one of the files did not exist. This whole command will be in one line. Show your session.

3.How many soft links are there in the /usr directory. Show the command and its output.

Create a file named students containing the following data in your current directory. Each line in this file represents a student's first name, last name, and 3 exam scores. Each line should be regarded as a record containing 5 fields separated by one or more tab characters. You must use the awk command to answer the questions below

Name 100 90 80

Name 70 80 90

Name 55 65 75

Name 75 76 77

Name 100 100 100

Name 90 95 98

Name 70 80 89

Name 90 85 89

Name 65 80 90

Name 75 65 77

4.Use AWK. What command line would display the contents of students file such that first names and last names are swapped?

5.Use AWK. What command line would display the first and last names of those who got 100 on their first exam (there are examples in the book)?

6.Use AWK. What command line would display the contents of the students file with line numbers in front of each line?

1 Expert Answer


Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.