technoman007
IS-IT--Management
so this piece of code compares the months. The data in node.txt is of this sort.
alpha1 Thu Aug 15 21:08:51 PDT 2012 - disable
alpha1 Thu Aug 15 21:11:43 PDT 2012 - enable
alpha1 Thu Mar 15 21:58:13 PDT 2012 - disable
alpha1 Sat Mar 24 00:41:12 PDT 2012 - enable
so the output basically should print "abc" twice .. but the if statement never passes. not sure wat im doing wrong
i would appreciate some help .. thanks
open(fho, "/home/Techno/$node.txt");
foreach(<fho>)
{
$var=$_;
$k=`date | awk '{print \$2}'`;
$n=`echo '$var' | awk '{print \$3}'`;
chomp($k);
chomp($n);
print "$k,$n";
if ($k eq $n)
{
print "abc\n";
}
alpha1 Thu Aug 15 21:08:51 PDT 2012 - disable
alpha1 Thu Aug 15 21:11:43 PDT 2012 - enable
alpha1 Thu Mar 15 21:58:13 PDT 2012 - disable
alpha1 Sat Mar 24 00:41:12 PDT 2012 - enable
so the output basically should print "abc" twice .. but the if statement never passes. not sure wat im doing wrong
i would appreciate some help .. thanks
open(fho, "/home/Techno/$node.txt");
foreach(<fho>)
{
$var=$_;
$k=`date | awk '{print \$2}'`;
$n=`echo '$var' | awk '{print \$3}'`;
chomp($k);
chomp($n);
print "$k,$n";
if ($k eq $n)
{
print "abc\n";
}