cancel
Showing results for 
Search instead for 
Did you mean: 

Scrip error

VICBUR1507
Frequent Advisor

Scrip error

Hi mates,

Happy New Year For everybody!!
I have a problem when I try to run the following script:
#!/usr/bin/ksh

#--------------------------------------------------------------------------------------
# Created by: Victor Burguillos
#
# Description: Filters a syslog file searching for lines generated during the pass
# N days before today. The filter ommits the results from TODAY. The search starts
# with the registers generated yesterday
#--------------------------------------------------------------------------------------

#--------------------------------------------------------------------------------------
# Parameters
#--------------------------------------------------------------------------------------
file_syslog=$1 # file to filter, including path
cmd_egrep="/usr/bin/egrep" # file to egrep, including path
days_before=2 # number of days before since today
#--------------------------------------------------------------------------------------


i=0
while [ $i -lt $days_before ]; do
date=$(perl -e "use POSIX;print strftime \"%b %e\",localtime time-($i*24*60*60);");
let i=i+1

if [[ $i -eq 1 ]]; then
search_filter=$date;
else
search_filter="$search_filter|$date";
fi
done

# This is the final result, an egrep with the dates as parameters, separated by an OR
$cmd_egrep "$search_filter" $file_syslog.

The erro that show me when I run this scrip is the following:
Can't locate POSIX.pm in @INC (@INC contains: /opt/perl5/lib/5.00502/PA-RISC1.1 /opt/perl5/lib/5.00502 /opt/perl5/lib/site_perl/5.005/PA-RISC1.1 /opt/perl5/lib/site_perl/5.005 .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
Can't locate POSIX.pm in @INC (@INC contains: /opt/perl5/lib/5.00502/PA-RISC1.1 /opt/perl5/lib/5.00502 /opt/perl5/lib/site_perl/5.005/PA-RISC1.1 /opt/perl5/lib/site_perl/5.005 .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
egrep: Unknown error

Any information about this???

Thanks
3 REPLIES
James R. Ferguson
Acclaimed Contributor

Re: Scrip error

Hi:

> Can't locate POSIX.pm in @INC (@INC contains: /opt/perl5/lib/5.00502/PA-RISC1.1 /opt/perl5/lib/5.00502 /opt/perl5/lib/site_perl/5.005/PA- ...

This says that the POSIX module can't be found in your Perl distribution. Your version is old, although I believe it should have supported the module. I would fetch and install a current one:

http://h20392.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=PERL

The Perl 5.8.8 version is rock-solid.

Regards!

...JRF...
VICBUR1507
Frequent Advisor

Re: Scrip error

Hi James,

I download this version let me check and let you know when I will finish
VICBUR1507
Frequent Advisor

Re: Scrip error

James.

Thank you very much its works.