reading file

I have this assignment. I have to read how many lines, tags, comments, links, chars, chars in tags and percentage of characters in tags in any given file. Here's an example output of what it should look like. Anyone have any suggestions? I've gotten as far as actually reading the file. Now I have to do the analysis below. Thanks.

Analysis of file
----------------

Number of lines: 9
Number of tags: 8
Number of comments: 1
Number of links: 1
Number of chars in file: 176
Number of chars in tags: 87
Percentage of characters in tags: 49.43%

Go line by line. Set a counter to track how many lines you read in. In each line, go through the characters to find the stuff you are looking for, and update counters as necessary. Next line. etc.
Topic archived. No new replies allowed.