Hi, I have a CSV file that I need to process. I don't have any code to really post, because I can't think of how to start this one... Anyway, I will post a sample from the CSV file, and what I am trying to get.
Sample:
,,,,
Group: ASDF_LKJ_SanFrancisco_Group(S),,SanFrancisco_Group(S),,
,Users (9),LNUM,AccountName,
,,54090,dlosa,
,,54090,crownroy,
,,1915,jackdan,
,,1315,makersmar,
,,1265,whisgin,
,,2415,cdasde,
,,54090,sfafdf,
,,54090,asdfdsf,
,,54090,afdasdfa,
,,,,
Group: ASDF_LKJ_Phoenix_Group(S),,Phoenix_Group(S),,
,Users (1),LNUM,AccountName,
,,36203,test_haackk,
,,,,
Group: ASDF_LKJ_NewYork_Group(S),,NewYork_Group(S),,
,Users (5),LNUM,AccountName,
,,7997,barb,
,,64081,cant,
,,64081,chan,
,,48293,chanjas,
,,64081,nish,
,,,,
Group: ASDF_LKJ_Portland_Group(S),,Portland_Group(S),,
,Users (3),LNUM,AccountName,
,,,Test_K,
,,,Test_l,
,,,Test_x,
As you can see, each seperate set is seperated by a header that starts with Group: and the next line that starts with ,Users.
I am trying to just print each of those out to a file, then count the numbers underneath and find the most common occurence. It would save the most common number and the output would look something like this:
Desired Output:
,,,,
Group: ASDF_LKJ_SanFrancisco_Group(S),,SanFrancisco_Group(S),,
,Users (9),LNUM,AccountName,
54090
,,,,
Group: ASDF_LKJ_Phoenix_Group(S),,Phoenix_Group(S),,
,Users (1),LNUM,AccountName,
36203
,,,,
Group: ASDF_LKJ_NewYork_Group(S),,ASNewYork_Group(S),,
,Users (5),LNUM,AccountName,
64081
Group: ASDF_LKJ_Portland_Group(S),,Portland_Group(S),,
,Users (3),LNUM,AccountName,
Basically, I just want to find the most commonly used numbers under each header, and print it out, discarding the other numbers.
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.