--%>

Write an AWK program

Write an AWK program which takes the following input _le and processes it.

$cat data.txt

John Do 111-1111 English 90 Maths 80

Alice Do 222-2222 English 90 Maths 90 Chemistry 93

The input _le has _rst 3 _elds _xed as _rst name, last name, and student id. After the student id, it has

a variable number of _elds which has a pair of name of a subject and points scored in that subject.

Your output should print the full name of the student, number of subjects taken, and his/her average

score. The output corresponding the above input _le is as follows:

$awk -f avgerage.awk data.txt

John Do: 2 subjects taken, average = 85

Alice Do: 3 subjects taken, average = 91

2.     Write a BASH/C shell script which takes a name of a directory as a command line

argument, and prints unique login name of the users having _les in that directory. Your code should

perform appropriate error checking.

A sample output is:

$sh name.sh /etc

mysql news root uucp

3.     Write a BASH/C shell script which takes name of one or more _les as a command line

argument, and prints the following information for each _le: owner, number of words in the _le, last

update time of the _le. Your code should have appropriate error checking.

 

The sample output is as follows:

$sh final.sh file1.txt file2.txt

file1.txt : ssaha : 25 : 2011-21-04 17:47

file2.txt : jliu : 16 : 2011-21-04 18:36

4.     Write a PERL script which takes a _le named input.txt as an input and processes it. The

input _le has the following format: _rstname lastname: pass/fail score%.

A sample input _le is:

$cat input.txt

John Do: pass 59%

Alice Do: fail 30%

Bob Do: PASS 80%

 

If the user has passed (i.e. has case insensitive \pass" in the 3rd _eld), then your code should print the

login name (_rst letter of _rst name followed by the last name, all in lowercase) of the user and his/her

corresponding score in fraction.

The output of your code on the above input should look like:

$perl final.pl

jdo: 0.59

bdo: 0.8

   Related Questions in Science

  • Q : Fairness Properties-Software lifecycle

    Fairness Properties: A fairness property is essentially a liveness property which holds that something good happens infinitely often (for example, a process activated infinitely often during an application execution—each process getting a fair t

  • Q : What is Video conferencing Video

    Video conferencing: Effective tool to cut down costs by using inexpensive webcams and laptops to hold video conferences. Also connect employees from all corners of the globe to come together, and share ideas and exchange thoughts.

  • Q : Biological diversity of ecosystem Is

    Is monoculture a system which contributes to great biological diversity of the ecosystem?

  • Q : Report ( Telehealth) Hi, Please find

    Hi, Please find the attachment and read it carefully. Use the reference must be from the last five years in APA6 style only. Put citation after each paragraph as example in attachment. Make sure that without plagiarism. If you can use some figures. Thanks

  • Q : Describe Data Independence Data

    Data Independence: A system is data independent if the values of the infinite program data it manipulates are not relevant to the behavior of the system—for example, a protocol that transmits messages may be proved correct regardless of the cont

  • Q : Describe parasitism Describe briefly

    Describe briefly the term parasitism?

  • Q : Explain DFS and BFS Tradeoffs DFS and

    DFS and BFS Tradeoffs: In general, DFS will have lower memory (space) complexity than BFS since only the information about the states and transitions on the current path needs to be stored. This contrasts with BFS, where all the states and transitions

  • Q : Define White-Box Testing White-Box

    White-Box Testing: We discuss here a framework that combines symbolic execution and model-checking techniques for automated test case generation in the context of Java programs. The framework is typically used for test input generation for white-box t

  • Q : Where the system time is hold Normal 0

    Normal 0 false false

  • Q : Blog in WordPress Normal 0 false false

    Normal 0 false false