Monday, August 8, 2011

awk and NBA point per shot leaders of top 50 scorers

paste into text file scr from http://sports.yahoo.com/nba/stats/bycategory?cat=Fielding&sort=25&qualified=0&conference=NBA&year=season_2010 with dropdown box "all players" option chosen for top 50 not 39

holy shit awk rocks

$ awk '{x=($23/($7 +($13 /2)));print x" "$1" "$2}' scr|sort -rn
1.21771 Ray Allen
1.21154 Paul Pierce
1.20863 Chauncey Billups
1.19481 Dirk Nowitzki
1.18961 Dwight Howard
1.18095 Stephen Curry
1.175 Kevin Martin
1.16087 LeBron James
1.15429 Kevin Love
1.15337 Pau Gasol
1.15217 Wesley Matthews
1.15177 Kevin Durant
1.14098 Manu Ginobili
1.13443 Paul Millsap
1.13333 Dwyane Wade
1.11821 Tony Parker
1.11642 Chris Bosh
1.10945 Eric Gordon
1.10744 Deron Williams
1.10722 Amar'e Stoudemire
1.09565 David West
1.09168 Carmelo Anthony
1.08943 Zach Randolph
1.08197 David Lee
1.08179 Danny Granger
1.07991 Derrick Rose
1.07902 Rudy Gay
1.0774 Luol Deng
1.07654 LaMarcus Aldridge
1.07431 Kobe Bryant
1.07368 Brook Lopez
1.07034 Carlos Boozer
1.06888 Blake Griffin
1.06752 Josh Smith
1.06494 Dorell Wright
1.06098 Nick Young
1.06087 Luis Scola
1.05702 Monta Ellis
1.05036 Russell Westbrook
1.04645 Andrea Bargnani
1.04202 Al Jefferson
1.03927 DeMar DeRozan
1.02247 Joe Johnson
1.0221 Stephen Jackson
1.01695 Antawn Jamison
1.00524 Michael Beasley
0.976744 Andray Blatche
0.972973 Brandon Jennings
0.967552 John Wall
0.949333 Tyreke Evans

amazing that the top team in NBA has top 2
celtics shoulda won title, injury and refs giving lebron 48 free throws 1 game stopped em, and garnett being a chipmunk

celts should win 2011 title

kobe is 30th lol
shows what a gunner he is and how simply taking as ton of shots makes you a star in todays NBA
in his big head defense lebron is 8th in point per shot among top 50 scorers
not too shabby! perhaps GASP lebron should take MORE shots
stats say it would benefit his team

1 comment:

Greggry said...

If you want to print the record number beside it you can pass it back into awk and use the NR variable:

awk '{x=($23/($7 +($13 /2)));print x" "$1" "$2}' scr.txt | sort -rn | awk '{ print NR, $1, $2, $3; }'

There's probably a better way, but this is a quick solution. This way you don't have to count to find out that Kobe's in 30th.