Member Avatar for green_lakers

<code>
Hi Guys,

I am new in perl. I have this file:-

2009-01-08 09:29:19 ABCD MS08-001 Works Suite 2005 (KB943973)
2009-01-08 09:29:19 ABCD MS08-001 Works Suite 2005 (KB943973)
2009-01-08 09:29:19 BCDE MS08-001 Works Suite 2005 (KB943973)
2009-01-09 09:29:19 FFFF MS08-001 Works Suite 2005 (KB943973)
2009-01-08 09:29:19 ABCD MS08-002 Works Suite 2006 (KB943974)
2009-01-08 09:29:19 ABCD MS08-002 Works Suite 2006 (KB943974)
2009-01-08 09:29:19 BCDE MS08-002 Works Suite 2006 (KB943974)
2009-01-09 09:29:19 FFFF MS08-002 Works Suite 2006 (KB943974)
ANYDATE FFFF MS08-003 Works Suite 2007 (KB943975)
and etc.....


OUTPUT:--------

TOTAL PATCH DESCRIPTION 2009-01-08 2009-01-09 ANYDATE
3 MS08-001 Works Suite 2005 (KB943973) 2 1 1
3 MS08-002 Works Suite 2006 (KB943974) 2 1 1
1 MS08-003 Works Suite 2007 (KB943975) 0 0 1


Data for 2009-01-08:
ABCD 943973 MS08-001 Works Suite 2005 (KB943973)
BCDE 943973 MS08-001 Works Suite 2005 (KB943973)
ABCD 943973 MS08-002 Works Suite 2006 (KB943974)
BCDE 943973 MS08-002 Works Suite 2006 (KB943974)


Data for 2009-01-08:
FFFF 943973 MS08-001 Works Suite 2005 (KB943973)
FFFF 943974 MS08-002 Works Suite 2006 (KB943974)


Date for ANYDATE (for example, 2008-12-08):
FFFF 943974 MS08-003 Works Suite 2007 (KB943975)
</code>

Did you have a question? What perl code have you tried to write to solve your programming rquirements?

Member Avatar for green_lakers

Did you have a question? What perl code have you tried to write to solve your programming rquirements?

Hi Kevin,

Sorry... my question was not properly provided. The question is how can i get this output from this file. I am really amatuer in scripting. if you can give me some ideas that would be of great help.

TOTAL PATCH DESCRIPTION 2009-01-08 2009-01-09 ANYDATE
3 MS08-001 Works Suite 2005 (KB943973) 2 1 1
3 MS08-002 Works Suite 2006 (KB943974) 2 1 1
1 MS08-003 Works Suite 2007 (KB943975) 0 0 1


Data for 2009-01-08:
ABCD 943973 MS08-001 Works Suite 2005 (KB943973)
BCDE 943973 MS08-001 Works Suite 2005 (KB943973)
ABCD 943973 MS08-002 Works Suite 2006 (KB943974)
BCDE 943973 MS08-002 Works Suite 2006 (KB943974)


Data for 2009-01-08:
FFFF 943973 MS08-001 Works Suite 2005 (KB943973)
FFFF 943974 MS08-002 Works Suite 2006 (KB943974)


Date for ANYDATE (for example, 2008-12-08):
FFFF 943974 MS08-003 Works Suite 2007 (KB943975)

I am not interested in helping you.

Is this homework, or what is it that you want to accomplish?

Member Avatar for green_lakers

Hi kevin,

really desparate to get some help here. I tried this:-

open (MYFILE, 'file.txt');

while (defined (my $record = <MYFILE>)) {

chomp $record;

my @lines = split "\t", $record;

.......I know upto this but i dont know how i can do the count of unique values and store it by date...Your help will be greatly appreciated.

Member Avatar for green_lakers

Hi there,

I want to get this output :-

TOTAL PATCH DESCRIPTION 2009-01-08 2009-01-09 ANYDATE
3 MS08-001 Works Suite 2005 (KB943973) 2 1 1
3 MS08-002 Works Suite 2006 (KB943974) 2 1 1
1 MS08-003 Works Suite 2007 (KB943975) 0 0 1


Data for 2009-01-08:
ABCD 943973 MS08-001 Works Suite 2005 (KB943973)
BCDE 943973 MS08-001 Works Suite 2005 (KB943973)
ABCD 943973 MS08-002 Works Suite 2006 (KB943974)
BCDE 943973 MS08-002 Works Suite 2006 (KB943974)


Data for 2009-01-08:
FFFF 943973 MS08-001 Works Suite 2005 (KB943973)
FFFF 943974 MS08-002 Works Suite 2006 (KB943974)


Date for ANYDATE (for example, 2008-12-08):
FFFF 943974 MS08-003 Works Suite 2007 (KB943975)


I have tried this :---
open (MYFILE, 'file.txt');

while (defined (my $record = <MYFILE>)) {

chomp $record;

my @lines = split "\t", $record;

.......I know upto this but i dont know how i can do the count of unique values and store it by date...Your help will be greatly appreciated.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.