Sponsored Content
Full Discussion: count average
Top Forums Shell Programming and Scripting count average Post 302199008 by mleplawy on Sunday 25th of May 2008 04:05:17 PM
Old 05-25-2008
count average

Hi Friends,
Can any one help me with count average of student marks in this file (i can not change structure of the input file):

input file:

1:John Smith:2 3 4 5
2:Mark Anderson:3 2
3:Susan Waterman:2 4 2

(numbers of marks are different)

output:

Name:John Smith
ID#: 1
Avg. mark: 3.5

Name:Mark Anderson
ID#: 2
Avg. mark: 2.5

Name:Mark Anderson
ID#: 2
Avg. mark: 2.6667

Name:Susan Waterman
ID#: 3
Avg. mark: 2.5
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

count average

Hi Friends, Can any one help me with count average of student marks in this file (i can not change structure of the input file): input file: 1 - student ID 2 - student name 3 - group ID 4 - teacher ID 5 - marks (numbers of marks are different) 1:John Smith:2:3:2 3 4 5 2:Mark... (1 Reply)
Discussion started by: mleplawy
1 Replies

2. Shell Programming and Scripting

Getting Sum, Count and Distinct Count of a file

Hi all this is a UNIX question. I have a large flat file with millions of records. col1|col2|col3 1|a|b 2|c|d 3|e|f 3|g|h footer**** I am supposed to calculate the sum of col1 1+2+3+3=9, count of col1 1,2,3,3=4, and distinct count of col1 1,2,3=c3 I would like it if you avoid... (4 Replies)
Discussion started by: singhabhijit
4 Replies

3. Shell Programming and Scripting

count identical strings print last row and count

I have a sorted file like: Apple 3 Apple 5 Apple 8 Banana 2 Banana 3 Grape 31 Orange 7 Orange 13 I'd like to search $1 and if $1 is not the same as $1 in the previous row print that row and print the number of times $1 was found. so the output would look like: Apple 8 3 Banana... (2 Replies)
Discussion started by: dcfargo
2 Replies

4. Shell Programming and Scripting

Count time min/max/average for ping

I am redirecting my ping output to a file. The sample output is like this: 64 bytes from xx.xx.xx.167: icmp_seq=4490 ttl=116 3.75 ms 2011Jul12- 15 40 16 64 bytes from xx.xx.xx.167: icmp_seq=4491 ttl=116 5.29 ms 2011Jul12- 15 40 17 64 bytes from xx.xx.xx.167: icmp_seq=4492 ttl=116 4.88 ms... (6 Replies)
Discussion started by: zorrox
6 Replies

5. Shell Programming and Scripting

How to find the average,min,max ,total count?

Hi , Below is my sample data,I have this 8 column(A,B,C,D,E,F,G,H) in csv file. A , B ,C ,D ,E ,F,G ,H 4141,127337,24,15,20,69,72.0,-3 4141,128864,24,15,20,65,66.0,-1 4141,910053,24,15,4,4,5.0,-1 4141,910383,24,15,22,3,4.0,-1 4141,496969,24,15,14,6,-24.0,-18... (7 Replies)
Discussion started by: vinothsekark
7 Replies

6. Shell Programming and Scripting

Compare file1 header count with file2 line count

What I'm trying to accomplish. I receive a Header and Detail file for daily processing. The detail file comes first which holds data, the header is a receipt of the detail file and has the detail files record count. Before processing the detail file I would like to put a wrapper around another... (4 Replies)
Discussion started by: pone2332
4 Replies

7. UNIX for Beginners Questions & Answers

How to count average and max respon time?

sorry i will revise first (1 Reply)
Discussion started by: fajar_3t3
1 Replies

8. UNIX for Beginners Questions & Answers

awk or sed script to count number of occurrences and creating an average

Hi Friends , I am having one problem as stated file . Having an input CSV file as shown in the code U_TOP_LOGIC/U_HPB2/U_HBRIDGE2/i_core/i_paddr_reg_2_/Q,1,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,1,1,0,0,0,0... (4 Replies)
Discussion started by: kshitij
4 Replies

9. UNIX for Beginners Questions & Answers

How to find the count of IP addresses that belong to different subnets and display the count?

Hi, I have a file with a list of bunch of IP addresses from different VLAN's . I am trying to find the list the number of each vlan occurence in the output Here is how my file looks like 1.1.1.1 1.1.1.2 1.1.1.3 1.1.2.1 1.1.2.2 1.1.3.1 1.1.3.2 1.1.3.3 1.1.3.4 So what I am trying... (2 Replies)
Discussion started by: new2prog
2 Replies
sigwaittest(8)															    sigwaittest(8)

NAME
sigwaittest - Start two threads or fork two processes and measure the latency between sending and receiving a signal SYNTAX
sigwaittest [-a|-a PROC] [-b USEC] [-d DIST] [-f] [-i INTV] [-l loops] [-p PRIO] [-t|-t NUM] DESCRIPTION
The program sigwaittest starts two threads or, optionally, forks two processes that are synchonized via signals and measures the latency between sending a signal and returning from sigwait(). OPTIONS
-a, --affinity[=PROC] Run on procesor number PROC. If PROC is not specified, run on current processor. -b, --breaktrace=USEC Send break trace command when latency > USEC. This is a debugging option to control the latency tracer in the realtime preemption patch. It is useful to track down unexpected large latencies of a system. -d, --distance=DIST Set the distance of thread intervals in microseconds (default is 500 us). When cylictest is called with the -t option and more than one thread is created, then this distance value is added to the interval of the threads: Interval(thread N) = Interval(thread N-1) + DIST -f, --fork Instead of creating threads (which is the default), fork new processes -i, --interval=INTV Set the base interval of the thread(s) in microseconds (default is 1000 us). This sets the interval of the first thread. See also -d. -l, --loops=LOOPS Set the number of loops. The default is 0 (endless). This option is useful for automated tests with a given number of test cycles. sigwaittest is stopped once the number of timer intervals has been reached. -p, --prio=PRIO Set the priority of the process. -t, --threads[=NUM] Set the number of test threads (default is 1, if this option is not given). If NUM is specified, create NUM test threads. If NUM is not specifed, NUM is set to the number of available CPUs. EXAMPLES
The following example was running on a 4-way CPU: # sigwaittest -a -t -p99 -i100 -d25 -l1000000 #0: ID11510, P99, CPU0, I100; #1: ID11511, P99, CPU0, Cycles 1000000 #2: ID11512, P98, CPU1, I125; #3: ID11513, P98, CPU1, Cycles 817484 #4: ID11514, P97, CPU2, I150; #5: ID11515, P97, CPU2, Cycles 668213 #6: ID11516, P96, CPU3, I175; #7: ID11517, P96, CPU3, Cycles 597344 #1 -> #0, Min 1, Cur 2, Avg 3, Max 30 #3 -> #2, Min 1, Cur 26, Avg 3, Max 42 #5 -> #4, Min 1, Cur 46, Avg 4, Max 67 #7 -> #6, Min 1, Cur 2, Avg 3, Max 74 AUTHORS
Carsten Emde <C.Emde@osadl.org> SEE ALSO
kill(2), sigwait(3) 0.1 sigwaittest(8)
All times are GMT -4. The time now is 05:38 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy