Is the Round:1 a typical input to be left out?
Could you say from those above, what would be: "Matches" "Wins" "Ties" "Losses"? Could you show an example of output, instead of definitions of what you would like?
Please, include in the example what would you like to sort by.
It starts with every team in the league (just once). After that it's round 1.
Every round contains results from 6 games. Each match entry is organized into the following fields date: teams: matchscore: periodscores: spectators: arena. In total there is 50 rounds.
The calculation of match points should be as followed
if there is a victory for a team within three periods it gets 3 points.
If there is a loss for a team within three periods it gets 0 points.
If there is a tie after three periods each team get at least 1 point each. If a team wins within one of the two additional periods it gets 1 extra point.
I wanna do a script to do a summary of the matches and results.
I want my output to like something like this
Code:
Points Team Matches Wins Ties Losses
112 Djurgårdens If 50 33 9 8
97 Timrå If 50 30 5 15
And so on..
I'm thinking I need a loop to go over each team's home and away game. Then I need some kind of loop to see if a match contains more than 3 periods. Last I need a loop to read the score and give points.
I don't really know how to sort the text file to get just the information I need for each loop.
awk -F: '
NR==1 {print "Points\tTeam \tMatches\tWins\tTies\tLosses"
for (n = split ($0, TEAM); n > 0; n--) POINTS[TEAM[n]]=0
next
}
/^Round/ {next}
{ split ($2, TM, "-")
split ($3, RE, "-")
P = split ($4, PR, ",")
if (P > 3) {POINTS[TM[1]]++
POINTS[TM[2]]++
TIES[TM[1]]++
TIES[TM[2]]++
MATCHES[TM[1]]++
MATCHES[TM[2]]++
VAL = 1
}
else VAL = 3
if (RE[1] > RE[2]) {POINTS[TM[1]] += VAL
WINS[TM[1]]++
LOSSES[TM[2]]++
MATCHES[TM[1]]++
MATCHES[TM[2]]++
}
if (RE[1] < RE[2]) {POINTS[TM[2]] += VAL
WINS[TM[2]]++
LOSSES[TM[1]]++
MATCHES[TM[1]]++
MATCHES[TM[2]]++
}
}
END {for (p in POINTS) print POINTS[p], p, MATCHES[p]+0, WINS[p]+0, TIES[p]+0, LOSSES[p]+0
}
' OFS="\t" season2002-2003.txt
However the ouput gets like this
Code:
Points Team Matches Wins Ties Losses
66 S�dert�lje SK 59 23 9 27
79 Lule� HF 62 25 12 25
79 HV 71 63 24 13 26
60 MIF Redhawks 60 22 10 28
53 Bryn�s IF 60 17 10 33
88 Djurg�rdens IF 57 29 7 21
42 Link�pings HC 59 13 9 37
68 Leksands IF 56 24 6 26
90 Timr� IK 58 30 8 20
94 F�rjestads BK 60 30 10 20
78 MODO Hockey 58 28 8 22
103 Fr�lunda HC 60 35 10 15
The count on how many matches each team play in the text file doesn't match. (should be 50, bcuz it's 50 rounds)
Can I do a counter, like count the word "round" and add that to Matches for each team?
Atm incase of a tie (after 3 periods), both team get 1 point each, I need a loop to give one of the teams 1 extra point if they scored in period 4 or 5 (which is the overtime).
---------- Post updated at 12:00 PM ---------- Previous update was at 11:07 AM ----------
I think I understand the problem with matches.
The script with periods more than 3 counts as a tie, and give each team +1 in matches.
After that the script search the result and add +1 in matches for each team.
However, if one of the team wins in overtime the count for matches is +1 for the tie and +1 for the result.
Hi Unix Admins,
I wanted to sort a file in a specific order,
i.e the input file contains two fields and the first column is not unique and had to be sorted. example
Input File
-------
2014-10-21:Rand1
2014-11-02:Rand2
2014-11-02:Rand3
2014-11-02:Rand4
2014-11-03:Rand5
2014-11-04:Rand6... (4 Replies)
Hi Guys,
My client (dear clients, I hate to love you) has the funky idea of sorting a 5G flat file.
Certainly enough, this is taking forever and also fulls the / of our machine.
Any idea of how we could proceed to make this a little bit more efficient?
Maybe by forcing sort to "stay in... (7 Replies)
Hi,
I have two files, one of which I would like to sort based on the order of the data in the second. I would like to do this using a simple unix statement.
My two files as follows:
File 1:
12345 1 2 2 2 0 0
12349 0 0 2 2 1 2
12350 1 2 1 2 2 2
.
.
.
File2:
12350... (3 Replies)
I'm trying to write a script that will look in an /exports folder for the oldest export file and move it to a /staging folder. "Oldest" in this case is actually determined by date information embedded in the file names themselves.
Also, the script should only move a file from /exports to... (6 Replies)
I have the file as follow:
A: 60
B: 80
C: 40
D: 11
E: 100
I want to sort the file and get the output to file as follow:
E: 100
B: 80
A: 60
C: 40
D: 11
Could any one help me please? (1 Reply)
i have a data in afile like this
**************************************
sree
sree@yahoo.com
98662323432
*************************************
phani
phani@yahoo.com
98662323344
*************************************
i want to sort the file with respect to name.
how can i do this.
thank... (5 Replies)
i ahve a file like:
*************************************
sree
122132
12321
***********************************
phani
21321
3213214
******************************
dddsds
213213123
23213213
*******************************
i want to sort the file with respect to name how we can do this... (1 Reply)
hi everyone, i have a document where i have email addresess and names, i need to check if the email addresses are uniq, if they repeat erase one of them, how can i do that?
document sample:
aD00763357@cucei.udg.mx,ABRAHAM ANTONIO SEVERIANO
a199721111@cucei.udg.mx,ABRAHAM GONZALEZ... (4 Replies)
Hi,
I have this file (filex)
07-11-2003 10:11:12!cccc!ddd!eeeeeeee
07-11-2003 09:11:11!dddd!kkkkk!xxxxxx
09-12-2003 14:18:43!aaaa!bbbbb!cccc
where I need to sort it by date+time in this order:
09-12-2003 14:18:43!aaaa!bbbbb!cccc
07-11-2003 10:11:12!cccc!ddd!eeeeeeee
07-11-2003... (3 Replies)