Come on, I can give you a Perl solution to the problem even before you have figured out how to load the data into a database. We have a text file, Perl is very good at manipulating textual data, why not using Perl?
As an example:
$ echo '
> 1 11/12/2014 9:46 A
> 2 11/12/2014 9:47 B
> 3 11/12/2014 9:48 A
> 4 11/12/2014 9:49 A
> 5 11/12/2014 9:50 A
> 6 11/12/2014 9:51 A
> 7 11/12/2014 9:52 B
> 8 11/12/2014 9:53 B
> 9 11/12/2014 9:54 B
> 10 11/12/2014 9:55 B
> 11 11/12/2014 9:56 B
> 12 11/12/2014 9:57 C
> 13 11/12/2014 9:58 C
> 14 11/12/2014 9:59 C
> 15 11/12/2014 10:00 A
> 16 11/12/2014 10:01 B
> 17 11/12/2014 10:02 C
> 18 11/12/2014 10:03 C
> ' | perl -nE 'chomp; $h{$1}++ if /(\w\s*$)/; END { say "Letter $_
+appears $h{$_} times" for keys %h;}'
Letter A appears 6 times
Letter C appears 5 times
Letter B appears 7 times
It took me less time to write the one line of code used above than to write this post.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.