Hi folks
I have a small problem wherein i have to obtain the data for the last 5 minutes from a logfile. I need to schedule this script in the crontab so that it runs every 5 minutes. A sample of the data is as shown
Quote:
03:03: Error:Exception while creating telnet instance for switch HLR3please verify userid,password and IP address
03:15: Error:Exception while creating telnet instance for switch HLR3please verify userid,password and IP address
03:18: Error:Exception while creating telnet instance for switch HLR3please verify userid,password and IP address
03:24: Error:Exception while creating telnet instance for switch HLR3please verify userid,password and IP address
03:28: Error:Exception while creating telnet instance for switch HLR3please verify userid,password and IP address
03:31: Error:Exception while creating telnet instance for switch HLR3please verify userid,password and IP address
03:34: Error:Exception while creating telnet instance for switch HLR3please verify userid,password and IP address
03:36: Link is down
03:37: Error:Exception while creating telnet instance for switch HLR3please verify userid,password and IP address
03:38: Error:Exception while creating telnet instance for switch HLR3please verify userid,password and IP address
03:38: Link is down
03:39: Link is down
03:42: Error:Exception while creating telnet instance for switch HLR3please verify userid,password and IP address
The first field is the hour, second the minute, third field is msg (where : is field separatpr)
i tried using awk which worked on HP-UX systems.
Quote:
hh='date +%H'
mi='date +%M'
pp=`expr $mi-5`
awk -F":" -v "h=$hh" -v "min=$mi" -v "period=$pp" '$1==h && $2 <= min && $2 >= period {print}' filename > outputfilename
Like i said this works on HP-UX but i need to run this on a SunOS system where i get the following syntax error
Quote:
awk: syntax error near line 1
awk: bailing out near line 1
Can anyone please help me out. Is there something that i am overlooking. If not awk, is there any other way to obtain the data that i want?
Thanks in advance