Football time again.

Football time again. Here is a quick script to get some NFL scores. You will have to read the script to set the values for what part of the season and what week to show. I did not put a lot of time into formatting as it is easy for me to read as is.  The script might be use for other sports depending on the format.



------------------------------------------------
nfl data for phase = 1 week = 3 season = 2014
------------------------------------------------

       Home           Score              Away

Thursday, August 14 - (Preseason)
Jacksonville 19 - 20 Chicago Final
Friday, August 15 - (Preseason)
Philadelphia 35 - 42 New England Final
Tennessee 24 - 31 New Orleans Final
Detroit 26 - 27 Oakland Final
San Diego 14 - 41 Seattle Final
Saturday, August 16 - (Preseason)
Green Bay 21 - 7 St. Louis Final
NY Jets 25 - 17 Cincinnati Final
Baltimore 37 - 30 Dallas Final
NY Giants 27 - 26 Indianapolis Final
Buffalo 16 - 19 Pittsburgh Final
Miami 20 - 14 Tampa Bay Final
Atlanta 7 - 32 Houston Final
Arizona 28 - 30 Minnesota Final
Sunday, August 17 - (Preseason)
Denver 34 - 0 San Francisco Final
Kansas City 16 - 28 Carolina Final
Monday, August 18 - (Preseason)
Cleveland 23 - 24 Washington Final

Standings

* AFC
* NFC

East

East
Team W L T Pct
NY Jets 2 0 0 1.000
Miami 1 1 0 .500
New England 1 1 0 .500
Buffalo 1 2 0 .333


North

North
Team W L T Pct
Baltimore 2 0 0 1.000
Pittsburgh 1 1 0 .500
Cincinnati 0 2 0 .000
Cleveland 0 2 0 .000


South

South
Team W L T Pct
Houston 1 1 0 .500
Jacksonville 1 1 0 .500
Tennessee 1 1 0 .500
Indianapolis 0 2 0 .000


West

West
Team W L T Pct
Denver 2 0 0 1.000
Kansas City 1 1 0 .500
Oakland 1 1 0 .500
San Diego 1 1 0 .500


East

East
Team W L T Pct
NY Giants 3 0 0 1.000
Washington 2 0 0 1.000
Dallas 0 2 0 .000
Philadelphia 0 2 0 .000


North

North
Team W L T Pct
Chicago 2 0 0 1.000
Minnesota 2 0 0 1.000
Detroit 1 1 0 .500
Green Bay 1 1 0 .500


South

South
Team W L T Pct
New Orleans 2 0 0 1.000
Atlanta 1 1 0 .500
Carolina 1 1 0 .500
Tampa Bay 0 2 0 .000


West

West
Team W L T Pct
Arizona 1 1 0 .500
Seattle 1 1 0 .500
San Francisco 0 2 0 .000
St. Louis 0 2 0 .000


Full Standings

---------------------------------------------



[code]
 ####################################
# Score  Grabber
#
#===============================
# Assignments
# --------------------------------
datafile="nflscorefile"
a=1
flag=0
week=3
# phase 1 is preseason phase 2 is regular season #phase 3 is
phase=1
season=2014
#finished week = 1 unfinished week = 0
weekfinished=1
league="nfl"
# end assignments
#=================================
#
# Get data file
#---------------------------------
case $weekfinished in
1)
elinks "http://sports.yahoo.com/$league/scoreboard/?week=$week&phase=$phase&season=$season"  > $datafile
;;
0)
elinks "http://sports.yahoo.com/$league/scoreboard/"  > $datafile
;;
*)
#
;;
esac
#=================================
#
# Extract and display data
#---------------------------------
while read line
do fdata[$a]=$line
echo $line | grep -q "Home Score Away"
if  [ $? -eq 0 ]; then
# header
clear
echo
echo ------------------------------------------------
echo  $league  data for phase = $phase  week = $week  season = $season
echo ------------------------------------------------
echo
echo "       Home           Score              Away"
echo ""
let "flag = 1"
fi
if [ $flag -eq 1 ]; then
echo $line | grep -q "Latest NFL Videos"
if [ $? -eq 0 ]; then
let "flag = 0"
else
echo $line | grep -q "Home Score Away"
if  [ $? -ne 0 ]; then
case $weekfinished in
1)
echo $line | sed 's/\[.*\]//'
;;
0)
echo $line
;;
*)
#
;;
esac
fi
fi
fi
let "a += 1"
done < $datafile
# footer
echo ---------------------------------------------
echo
#===============================
# End.
################################
[/code]

To get the full standings unformatted, wrote another script.

 ------------------------------------------------
American Football Conference - 2014 Regular SeasonAFC East Team Last
Pts 5
Buffalo Bills 2 1 0 .667 62 52 10 5 1-1 1-0 1-0 1.000 1-1 .500 1-0 1L 2-1
New England 2 1 0 .667 66 49 17 6 1-0 1-1 0-1 .000 1-1 .500 1-0 2W 2-1
Patriots
Miami 1 2 0 .333 58 83 -25 5 1-1 0-1 1-1 .500 1-2 .333 0-0 2L 1-2
Dolphins
New York Jets 1 2 0 .333 62 72 -10 6 1-1 0-1 0-0 .000 1-0 1.000 0-2 2L 1-2
AFC North Team Last
Pts 5
Cincinnati 3 0 0 1.000 80 33 47 8 2-0 1-0 1-0 1.000 2-0 1.000 1-0 3W 3-0
Bengals
Baltimore 2 1 0 .667 65 50 15 6 1-1 1-0 2-1 .667 2-1 .667 0-0 2W 2-1
Ravens
Pittsburgh 2 1 0 .667 73 72 1 7 1-0 1-1 1-1 .500 1-1 .500 1-0 1W 2-1
Steelers
Cleveland 1 2 0 .333 74 77 -3 9 1-1 0-1 0-2 .000 0-2 .000 1-0 1L 1-2
Browns
...
...
...


Have to rewrite the script a little bit so the data will go into a spreadsheet



#####################################
# Score  Grabber
#
#===============================
# Assignments
# --------------------------------
datafile="nflstandingsfile"
a=1
flag=0
# end assignments
#=================================
#
# Get data file
#---------------------------------
elinks "http://www.nfl.com/standings"  > $datafile
#
#=================================
#
# Extract and display data
#---------------------------------
while read line
do fdata[$a]=$line
echo $line | grep -q "American Football"
if  [ $? -eq 0 ]; then
    # header
    echo ------------------------------------------------
    let "flag = 1"
fi
if [ $flag -eq 1 ]; then
    echo $line | grep -q "x - C"
    if [ $? -eq 0 ]; then
        let "flag = 0"
    else
        echo $line | sed 's/\[.*\]//'
    fi
fi
let "a += 1"
done < $datafile
# footer
echo ---------------------------------------------
echo
#===============================
# End.
###############################


Comments

Popular posts from this blog

Guiless?

MSOffice vs Libreoffice

Raspberry pi zero.