Hi to all,
I have user registry I want list out all user register by date range.For that i am using grep to filter the records but the regex is not working.I know i build wrong regex could u please anybody suggest me how do i do that.
[CODE=perl]#!/usr/bin/perl
my $cUser_Name="ra jiv101";
$cYear1=2008;
$cYear2=2008;
$cMon1=02;
$cMon2=02;
$cDay2=18;
$cDay1=18;
my @data=<DATA>;
my @file=grep(/$cUser_Name#[$cYear1-$cYear2]-[$cMon1-$cMon2]-[$cDay1-$cDay2]/,@data);
print @file;
__END__
rajiv101#2008-02-16#10:06:00#19: 49:33#127.0.0.1 #19:49:54#18:18 :00#127.0.0.1#C Y#Y
rajiv101#2008-02-17#10:06:00#19: 49:33#127.0.0.1 #19:49:54#18:18 :00#127.0.0.1#C Y#Y
rajiv101#2008-02-17#10:06:00#19: 49:33#127.0.0.1 #19:49:54#18:18 :00#127.0.0.1#C Y#Y
rajiv101#2008-02-18#10:06:00#19: 49:33#127.0.0.1 #19:49:54#18:18 :00#127.0.0.1#C Y#Y
rajiv101#2008-02-18#10:06:00#19: 49:33#127.0.0.1 #19:49:54#18:18 :00#127.0.0.1#C Y#Y
rajiv101#2008-02-19#10:06:00#19: 49:33#127.0.0.1 #19:49:54#18:18 :00#127.0.0.1#C Y#Y[/CODE]
How do i specify the date range in regexp.The character class [] is not use to specify the range which is more than one char.
Is any idea.
Thank u
Rajiv.
I have user registry I want list out all user register by date range.For that i am using grep to filter the records but the regex is not working.I know i build wrong regex could u please anybody suggest me how do i do that.
[CODE=perl]#!/usr/bin/perl
my $cUser_Name="ra jiv101";
$cYear1=2008;
$cYear2=2008;
$cMon1=02;
$cMon2=02;
$cDay2=18;
$cDay1=18;
my @data=<DATA>;
my @file=grep(/$cUser_Name#[$cYear1-$cYear2]-[$cMon1-$cMon2]-[$cDay1-$cDay2]/,@data);
print @file;
__END__
rajiv101#2008-02-16#10:06:00#19: 49:33#127.0.0.1 #19:49:54#18:18 :00#127.0.0.1#C Y#Y
rajiv101#2008-02-17#10:06:00#19: 49:33#127.0.0.1 #19:49:54#18:18 :00#127.0.0.1#C Y#Y
rajiv101#2008-02-17#10:06:00#19: 49:33#127.0.0.1 #19:49:54#18:18 :00#127.0.0.1#C Y#Y
rajiv101#2008-02-18#10:06:00#19: 49:33#127.0.0.1 #19:49:54#18:18 :00#127.0.0.1#C Y#Y
rajiv101#2008-02-18#10:06:00#19: 49:33#127.0.0.1 #19:49:54#18:18 :00#127.0.0.1#C Y#Y
rajiv101#2008-02-19#10:06:00#19: 49:33#127.0.0.1 #19:49:54#18:18 :00#127.0.0.1#C Y#Y[/CODE]
How do i specify the date range in regexp.The character class [] is not use to specify the range which is more than one char.
Is any idea.
Thank u
Rajiv.
Comment