Hi Monks,
I have one file which contains the information of all the
users who r login to the machine in between 10 minutes,the
file contains fallowing format
time maxusrat_a_time loggeduser usernames
1.00 50 10 x,y,z,w,u,e,g,j,k,a
1.10 50 13 x,y,b,a,g,j,k,r,,n,m,s,
1.20 50 05 c,t,g,q,f
1.50 50 08 a,t,y,w,z,x,s,b
2.00 50 14 x,y,u,b,g,f,s,a,i,o,p,c
from the above file i grouped the usernames in to 3 groups
so,that i want to calculate for a perticilar intervel how
meny of group1 ,group2 and group3 are loggedin to the server.
i need result like below
1.00 5(group1)user,5(group2)users are logged in
fallowing is the code i am trying to solve the solution
@GRP1=(ravindkr,anandku,mparamas,anbarasr,subashin,prakasku,bsendray,
+pregunat,andccadm,nkhuntia,vdeshpan,dbalasub,rbalakri);
@GRP2=(awsdel,lpalanic,masubram,bpakanat,mshifan,asrajama,vidhyan,apat
+nayi,samallik,ikrishna,adityam,susajja,vramana,raghuran);
@GRP3=(mahendrd,ranantan,knittala,sathyam,bmallapr,skummara,prasantn,s
+rivatss,ramack,dmurugap,pparichi,esettu,babuk,hpandura,brengana);
@GRP4=(thendraa,samarenb,slekkala,apatnayi,psundar,isivapra,pjayaram,s
+unandap,speriasa,raallaga,gelango,dchockal,ldash);
open(FH,"_today_data.txt") or die "can't open the file$!\n";
while($line=<FH>)
{
chomp($line);
@usr=substr($line,8,2);
@time=substr($line,0,4);
@username=substr($line,16);
foreach $a (@username)
{
@username1 = split(',', $a);
print "@time\t @usr\t @username1\n";
}
}
keep pouring your ideas.......
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.