# woc1.py
# Written by Todd Wareham for CS 2500
"""
Given the name of a text file as a command-line argument, prints the number 
 of occurences of the word "line" in that file.
"""

import sys

if len(sys.argv) != 2:
    print "usage: python", sys.argv[0], "filename"
    sys.exit(1)

count = 0

for line in open(sys.argv[1]):
    for x in line.split():
        if x == "line":
	    count = count + 1

print "The word \"line\" occurs ", count, "times in file \"", \
      sys.argv[1], "\""

