awk Script Output Help


 
Thread Tools Search this Thread
Top Forums UNIX for Beginners Questions & Answers awk Script Output Help
# 8  
Old 02-21-2019
Code:
    	 	 	 	 	 	     	 	 	 	 	 	 		Student 		Catehory 		Assignment 		Score 		Possible 	 	 		Chelsey 		Homework 		H01 		90 		100 	 	 		Chelsey 		Homework 		H02 		89 		100 	 	 		Chelsey 		Homework 		H03 		77 		100 	 	 		Chelsey 		Homework 		H04 		80 		100 	 	 		Chelsey 		Homework 		H05 		82 		100 	 	 		Chelsey 		Homework 		H06 		84 		100 	 	 		Chelsey 		Homework 		H07 		86 		100 	 	 		Chelsey 		Lab 		L01 		91 		100 	 	 		Chelsey 		Lab 		L02 		100 		100 	 	 		Chelsey 		Lab 		L03 		100 		100 	 	 		Chelsey 		Lab 		L04 		100 		100 	 	 		Chelsey 		Lab 		L05 		96 		100 	 	 		Chelsey 		Lab 		L06 		80 		100 	 	 		Chelsey 		Lab 		L07 		81 		100 	 	 		Chelsey 		Quiz 		Q01 		100 		100 	 	 		Chelsey 		Quiz 		Q02 		100 		100 	 	 		Chelsey 		Quiz 		Q03 		98 		100 	 	 		Chelsey 		Quiz 		Q04 		93 		100 	 	 		Chelsey 		Quiz 		Q05 		99 		100 	 	 		Chelsey 		Quiz 		Q06 		88 		100 	 	 		Chelsey 		Quiz 		Q07 		100 		100 	 	 		Chelsey 		Final 		FINAL 		82 		100 	 	 		Chelsey 		Survey 		WS 		5 		5 	 	 		Sam 		Homework 		H01 		19 		100 	 	 		Sam 		Homework 		H02 		82 		100 	 	 		Sam 		Homework 		H03 		95 		100 	 	 		Sam 		Homework 		H04 		46 		100 	 	 		Sam 		Homework 		H05 		82 		100 	 	 		Sam 		Homework 		H06 		97 		100 	 	 		Sam 		Homework 		H07 		52 		100 	 	 		Sam 		Lab 		L01 		41 		100 	 	 		Sam 		Lab 		L02 		85 		100 	 	 		Sam 		Lab 		L03 		99 		100 	 	 		Sam 		Lab 		L04 		99 		100 	 	 		Sam 		Lab 		L05 		0 		100 	 	 		Sam 		Lab 		L06 		0 		100 	 	 		Sam 		Lab 		L07 		0 		100 	 	 		Sam 		Quiz 		Q01 		91 		100 	 	 		Sam 		Quiz 		Q02 		85 		100 	 	 		Sam 		Quiz 		Q03 		33 		100 	 	 		Sam 		Quiz 		Q04 		64 		100 	 	 		Sam 		Quiz 		Q05 		54 		100 	 	 		Sam 		Quiz 		Q06 		95 		100 	 	 		Sam 		Quiz 		Q07 		68 		100 	 	 		Sam 		Final 		FINAL 		58 		100 	 	 		Sam 		Survey 		WS 		5 		5 	 	 		Andrew 		Homework 		H01 		25 		100 	 	 		Andrew 		Homework 		H02 		47 		100 	 	 		Andrew 		Homework 		H03 		85 		100 	 	 		Andrew 		Homework 		H04 		65 		100 	 	 		Andrew 		Homework 		H05 		54 		100 	 	 		Andrew 		Homework 		H06 		58 		100 	 	 		Andrew 		Homework 		H07 		52 		100 	 	 		Andrew 		Lab 		L01 		87 		100 	 	 		Andrew 		Lab 		L02 		45 		100 	 	 		Andrew 		Lab 		L03 		92 		100 	 	 		Andrew 		Lab 		L04 		48 		100 	 	 		Andrew 		Lab 		L05 		42 		100 	 	 		Andrew 		Lab 		L06 		99 		100 	 	 		Andrew 		Lab 		L07 		86 		100 	 	 		Andrew 		Quiz 		Q01 		25 		100 	 	 		Andrew 		Quiz 		Q02 		84 		100 	 	 		Andrew 		Quiz 		Q03 		59 		100 	 	 		Andrew 		Quiz 		Q04 		93 		100 	 	 		Andrew 		Quiz 		Q05 		85 		100 	 	 		Andrew 		Quiz 		Q06 		94 		100 	 	 		Andrew 		Quiz 		Q07 		58 		100 	 	 		Andrew 		Final 		FINAL 		99 		100 	 	 		Andrew 		Survey 		WS 		5 		5 	 	 		Ava 		Homework 		H01 		55 		100 	 	 		Ava 		Homework 		H02 		95 		100 	 	 		Ava 		Homework 		H03 		84 		100 	 	 		Ava 		Homework 		H04 		74 		100 	 	 		Ava 		Homework 		H05 		95 		100 	 	 		Ava 		Homework 		H06 		84 		100 	 	 		Ava 		Homework 		H07 		55 		100 	 	 		Ava 		Lab 		L01 		66 		100 	 	 		Ava 		Lab 		L02 		77 		100 	 	 		Ava 		Lab 		L03 		88 		100 	 	 		Ava 		Lab 		L04 		99 		100 	 	 		Ava 		Lab 		L05 		55 		100 	 	 		Ava 		Lab 		L06 		66 		100 	 	 		Ava 		Lab 		L07 		77 		100 	 	 		Ava 		Quiz 		Q01 		88 		100 	 	 		Ava 		Quiz 		Q02 		99 		100 	 	 		Ava 		Quiz 		Q03 		44 		100 	 	 		Ava 		Quiz 		Q04 		55 		100 	 	 		Ava 		Quiz 		Q05 		66 		100 	 	 		Ava 		Quiz 		Q06 		77 		100 	 	 		Ava 		Quiz 		Q07 		88 		100 	 	 		Ava 		Final 		FINAL 		99 		100 	 	 		Ava 		Survey 		WS 		5 		5 	 	 		Shane 		Homework 		H01 		50 		100 	 	 		Shane 		Homework 		H02 		60 		100 	 	 		Shane 		Homework 		H03 		70 		100 	 	 		Shane 		Homework 		H04 		60 		100 	 	 		Shane 		Homework 		H05 		70 		100 	 	 		Shane 		Homework 		H06 		80 		100 	 	 		Shane 		Homework 		H07 		90 		100 	 	 		Shane 		Lab 		L01 		90 		100 	 	 		Shane 		Lab 		L02 		0 		100 	 	 		Shane 		Lab 		L03 		100 		100 	 	 		Shane 		Lab 		L04 		50 		100 	 	 		Shane 		Lab 		L05 		40 		100 	 	 		Shane 		Lab 		L06 		60 		100 	 	 		Shane 		Lab 		L07 		80 		100 	 	 		Shane 		Quiz 		Q01 		70 		100 	 	 		Shane 		Quiz 		Q02 		90 		100 	 	 		Shane 		Quiz 		Q03 		100 		100 	 	 		Shane 		Quiz 		Q04 		100 		100 	 	 		Shane 		Quiz 		Q05 		80 		100 	 	 		Shane 		Quiz 		Q06 		80 		100 	 	 		Shane 		Quiz 		Q07 		80 		100 	 	 		Shane 		Final 		FINAL 		90 		100 	 	 		Shane 		Survey 		WS 		5 		5 	      		body,div,table,thead,tbody,tfoot,tr,th,td,p { font-family:"Liberation Sans"; font-size:x-small } 		a.comment-indicator:hover + comment { background:#ffd; position:absolute; display:block; border:1px solid black; padding:0.5em;  }  		a.comment-indicator { background:red; display:inline-block; border:1px solid black; width:0.5em; height:0.5em;  }  		comment { display:none;  }

--- Post updated at 10:49 PM ---

Code:
    	 	 	 	 	 	     	 	 	 	 	 	 		Student 		Catehory 		Assignment 		Score 		Possible 	 	 		Chelsey 		Homework 		H01 		90 		100 	 	 		Chelsey 		Homework 		H02 		89 		100 	 	 		Chelsey 		Homework 		H03 		77 		100 	 	 		Chelsey 		Homework 		H04 		80 		100 	 	 		Chelsey 		Homework 		H05 		82 		100 	 	 		Chelsey 		Homework 		H06 		84 		100 	 	 		Chelsey 		Homework 		H07 		86 		100 	 	 		Chelsey 		Lab 		L01 		91 		100 	 	 		Chelsey 		Lab 		L02 		100 		100 	 	 		Chelsey 		Lab 		L03 		100 		100 	 	 		Chelsey 		Lab 		L04 		100 		100 	 	 		Chelsey 		Lab 		L05 		96 		100 	 	 		Chelsey 		Lab 		L06 		80 		100 	 	 		Chelsey 		Lab 		L07 		81 		100 	 	 		Chelsey 		Quiz 		Q01 		100 		100 	 	 		Chelsey 		Quiz 		Q02 		100 		100 	 	 		Chelsey 		Quiz 		Q03 		98 		100 	 	 		Chelsey 		Quiz 		Q04 		93 		100 	 	 		Chelsey 		Quiz 		Q05 		99 		100 	 	 		Chelsey 		Quiz 		Q06 		88 		100 	 	 		Chelsey 		Quiz 		Q07 		100 		100 	 	 		Chelsey 		Final 		FINAL 		82 		100 	 	 		Chelsey 		Survey 		WS 		5 		5 	 	 		Sam 		Homework 		H01 		19 		100 	 	 		Sam 		Homework 		H02 		82 		100 	 	 		Sam 		Homework 		H03 		95 		100 	 	 		Sam 		Homework 		H04 		46 		100 	 	 		Sam 		Homework 		H05 		82 		100 	 	 		Sam 		Homework 		H06 		97 		100 	 	 		Sam 		Homework 		H07 		52 		100 	 	 		Sam 		Lab 		L01 		41 		100 	 	 		Sam 		Lab 		L02 		85 		100 	 	 		Sam 		Lab 		L03 		99 		100 	 	 		Sam 		Lab 		L04 		99 		100 	 	 		Sam 		Lab 		L05 		0 		100 	 	 		Sam 		Lab 		L06 		0 		100 	 	 		Sam 		Lab 		L07 		0 		100 	 	 		Sam 		Quiz 		Q01 		91 		100 	 	 		Sam 		Quiz 		Q02 		85 		100 	 	 		Sam 		Quiz 		Q03 		33 		100 	 	 		Sam 		Quiz 		Q04 		64 		100 	 	 		Sam 		Quiz 		Q05 		54 		100 	 	 		Sam 		Quiz 		Q06 		95 		100 	 	 		Sam 		Quiz 		Q07 		68 		100 	 	 		Sam 		Final 		FINAL 		58 		100 	 	 		Sam 		Survey 		WS 		5 		5 	 	 		Andrew 		Homework 		H01 		25 		100 	 	 		Andrew 		Homework 		H02 		47 		100 	 	 		Andrew 		Homework 		H03 		85 		100 	 	 		Andrew 		Homework 		H04 		65 		100 	 	 		Andrew 		Homework 		H05 		54 		100 	 	 		Andrew 		Homework 		H06 		58 		100 	 	 		Andrew 		Homework 		H07 		52 		100 	 	 		Andrew 		Lab 		L01 		87 		100 	 	 		Andrew 		Lab 		L02 		45 		100 	 	 		Andrew 		Lab 		L03 		92 		100 	 	 		Andrew 		Lab 		L04 		48 		100 	 	 		Andrew 		Lab 		L05 		42 		100 	 	 		Andrew 		Lab 		L06 		99 		100 	 	 		Andrew 		Lab 		L07 		86 		100 	 	 		Andrew 		Quiz 		Q01 		25 		100 	 	 		Andrew 		Quiz 		Q02 		84 		100 	 	 		Andrew 		Quiz 		Q03 		59 		100 	 	 		Andrew 		Quiz 		Q04 		93 		100 	 	 		Andrew 		Quiz 		Q05 		85 		100 	 	 		Andrew 		Quiz 		Q06 		94 		100 	 	 		Andrew 		Quiz 		Q07 		58 		100 	 	 		Andrew 		Final 		FINAL 		99 		100 	 	 		Andrew 		Survey 		WS 		5 		5 	 	 		Ava 		Homework 		H01 		55 		100 	 	 		Ava 		Homework 		H02 		95 		100 	 	 		Ava 		Homework 		H03 		84 		100 	 	 		Ava 		Homework 		H04 		74 		100 	 	 		Ava 		Homework 		H05 		95 		100 	 	 		Ava 		Homework 		H06 		84 		100 	 	 		Ava 		Homework 		H07 		55 		100 	 	 		Ava 		Lab 		L01 		66 		100 	 	 		Ava 		Lab 		L02 		77 		100 	 	 		Ava 		Lab 		L03 		88 		100 	 	 		Ava 		Lab 		L04 		99 		100 	 	 		Ava 		Lab 		L05 		55 		100 	 	 		Ava 		Lab 		L06 		66 		100 	 	 		Ava 		Lab 		L07 		77 		100 	 	 		Ava 		Quiz 		Q01 		88 		100 	 	 		Ava 		Quiz 		Q02 		99 		100 	 	 		Ava 		Quiz 		Q03 		44 		100 	 	 		Ava 		Quiz 		Q04 		55 		100 	 	 		Ava 		Quiz 		Q05 		66 		100 	 	 		Ava 		Quiz 		Q06 		77 		100 	 	 		Ava 		Quiz 		Q07 		88 		100 	 	 		Ava 		Final 		FINAL 		99 		100 	 	 		Ava 		Survey 		WS 		5 		5 	 	 		Shane 		Homework 		H01 		50 		100 	 	 		Shane 		Homework 		H02 		60 		100 	 	 		Shane 		Homework 		H03 		70 		100 	 	 		Shane 		Homework 		H04 		60 		100 	 	 		Shane 		Homework 		H05 		70 		100 	 	 		Shane 		Homework 		H06 		80 		100 	 	 		Shane 		Homework 		H07 		90 		100 	 	 		Shane 		Lab 		L01 		90 		100 	 	 		Shane 		Lab 		L02 		0 		100 	 	 		Shane 		Lab 		L03 		100 		100 	 	 		Shane 		Lab 		L04 		50 		100 	 	 		Shane 		Lab 		L05 		40 		100 	 	 		Shane 		Lab 		L06 		60 		100 	 	 		Shane 		Lab 		L07 		80 		100 	 	 		Shane 		Quiz 		Q01 		70 		100 	 	 		Shane 		Quiz 		Q02 		90 		100 	 	 		Shane 		Quiz 		Q03 		100 		100 	 	 		Shane 		Quiz 		Q04 		100 		100 	 	 		Shane 		Quiz 		Q05 		80 		100 	 	 		Shane 		Quiz 		Q06 		80 		100 	 	 		Shane 		Quiz 		Q07 		80 		100 	 	 		Shane 		Final 		FINAL 		90 		100 	 	 		Shane 		Survey 		WS 		5 		5 	      		body,div,table,thead,tbody,tfoot,tr,th,td,p { font-family:"Liberation Sans"; font-size:x-small } 		a.comment-indicator:hover + comment { background:#ffd; position:absolute; display:block; border:1px solid black; padding:0.5em;  }  		a.comment-indicator { background:red; display:inline-block; border:1px solid black; width:0.5em; height:0.5em;  }  		comment { display:none;  }

# 9  
Old 02-21-2019
Hi Marquez3105,
What we need you to put between the CODE tags is the contents of the file you are trying to process. We do not want you to be setting x-small font size, your choice of font family, your other WYSIWIG formatting to make the file contents look pretty; we just want the contents of the file.

Please try again without all of the WYSIWIG formatting that is making it impossible for us to figure out what data you are really trying to process.
# 10  
Old 02-21-2019
Quote:
Originally Posted by Don Cragun
Hi Marquez3105,
What we need you to put between the CODE tags is the contents of the file you are trying to process. We do not want you to be setting x-small font size, your choice of font family, your other WYSIWIG formatting to make the file contents look pretty; we just want the contents of the file.

Please try again without all of the WYSIWIG formatting that is making it impossible for us to figure out what data you are really trying to process.
I had similar issues in the past when using "Enhanced Interface" editor when posting.
Marquez3105,
go to UserCP->EditOptions and under Message Editor Interface chapter and under Message Editor Interface: choose Standard Editor - Extra Formatting Control.
Then Save Changes when done.
Then re-post your sample data within code tags.
Hope it helps
# 11  
Old 02-22-2019
Try also (no file preformatting needed):

Code:
awk '
BEGIN   {print "Name\tLow\tHigh\tAverage"
        }
        {for (i=6; i<NF; i+=5)  {if (!($i in MIN)) MIN[$i] = 1E100
                                 if (MIN[$i]>$(i+3)) MIN[$i] = $(i+3)
                                 if (MAX[$i]<$(i+3)) MAX[$i] = $(i+3)
                                 SUM[$i] += $(i+3)
                                 CNT[$i]++
                                }
        }
END     {for (m in MAX) print m, MIN[m], MAX[m], SUM[m]/CNT[m]
        }
' OFS="\t" file

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell script to call and sort awk script and output

I'm trying to create a shell script that takes a awk script that I wrote and a filename as an argument. I was able to get that done but I'm having trouble figuring out how to keep the header of the output at the top but sort the rest of the rows alphabetically. This is what I have now but it is... (1 Reply)
Discussion started by: Eric7giants
1 Replies

2. UNIX for Dummies Questions & Answers

Combine Both Output from the awk Script

Hi, Is there anyway to combine output from the awk scripting. file01.txt: AUE_CHMOD AUE_CHOWN AUE_CHROOT AUE_CONNECT AUE_ACCEPT AUE_FCHOWN AUE_FCHMOD AUE_SETREUID AUE_SETREGID AUE_FCHROOT AUE_PFEXEC AUE_SETUID AUE_NICE AUE_SETGID (9 Replies)
Discussion started by: alvinoo
9 Replies

3. Shell Programming and Scripting

awk script not producing output

Hi, I have a text file with some thousands of rows of the following kind (this will be referred to as the inputFileWithColorsAndNumbers.txt): Blue 6 Red 4 Blue 3 Yellow 4 Red 7 Colors in the left column and a number in the right one for each line. I want to run an awk... (5 Replies)
Discussion started by: Zooma
5 Replies

4. Shell Programming and Scripting

awk Script to format output

Hi all, I'm fairly new to this and learning along the way, so bare with me... I'm trying to format the output from a script to be more read-friendly. The output contains more servers and more processes but for as example it will do: Server: Test1 ... (4 Replies)
Discussion started by: Bobsonm
4 Replies

5. Shell Programming and Scripting

awk script to search output for a value and print

GOODNUMBERS="1 2 3 4 5 6 3 3 34 34 5 66 12" BADNUMBERS="7 3 12 5 66" for eachnum in `echo ${GOODNUMBERS}` do echo ${BADNUMBERS} | gawk -v threshold=${eachnum} '$1 != threshold' done what im trying to do with the above is, i want to print numbers that are in the GOODNUMBERS... (10 Replies)
Discussion started by: SkySmart
10 Replies

6. Shell Programming and Scripting

How to get fields and get output with awk or shell script.?

I have a flat file A.txt with field seperate by a pipe 2012/11/13 20:06:11 | 284:hawk pid=014268 opened Locations 12, 13, 14, 15 for /home/hawk_t112/t112/macteam/qt/NET12/full_ddr3_2X_FV_4BD_1.qt/dbFiles/t112.proto|2012/11/14 15:19:26 | still running |norway|norway 2012/11/14 12:53:51 | ... (6 Replies)
Discussion started by: sabercats
6 Replies

7. Shell Programming and Scripting

Awk script to run a sql and print the output to an output file

Hi All, I have around 900 Select Sql's which I would like to run in an awk script and print the output of those sql's in an txt file. Can you anyone pls let me know how do I do it and execute the awk script? Thanks. (4 Replies)
Discussion started by: adept
4 Replies

8. Shell Programming and Scripting

Colon in awk script output

I'm using AIX 5.3 and running a awk replace to modify data as follows: echo 1234: 1234 123 123 444 555 666 7777 | awk '/^:/{split($2,N);n=N} {n=$1} {sub(n,n+10000000)}1' 10001234 1234 123 123 444 555 666 7777 dumb question.. how do I get the colon back in, so it outputs 10001234: 1234... (4 Replies)
Discussion started by: say170
4 Replies

9. Shell Programming and Scripting

Format output using awk in script.

Guys, I have a script which hits the database and pulls the information that I need into files. Now I want to format these files to make them easy to read. The sample format of the file will be like.... <Start_of_File> Header1 .....xsdfsfa...adfa...... Header2 ....afefas .aefaefsdf...... (8 Replies)
Discussion started by: bperl
8 Replies

10. Shell Programming and Scripting

script the output with awk

Please i need your help. i made this script with awk, this scripts count and list a pattern for each directory in the output as shown. but not as desired. i want the output will be listed in a tabular way, using awk: cuenta_cdrs() { for dir in * do cd $dir for file in * do ... (4 Replies)
Discussion started by: alexcol
4 Replies
Login or Register to Ask a Question