The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
gdb for SunOS 5.6 shafi2all SUN Solaris 1 05-29-2008 04:39 AM
sed on SunOS 5.10 sylaan Shell Programming and Scripting 11 02-28-2008 05:49 AM
Migration of binary file from Sunos 5.8 to Sunos 5.9 Arvind Maurya UNIX for Advanced & Expert Users 1 07-12-2005 07:23 AM
SunOS 5.8 jxh461 Shell Programming and Scripting 5 03-13-2003 07:37 PM
SSH on SunOS 5.7 sp@c3m0nk3y UNIX for Dummies Questions & Answers 3 06-24-2001 08:35 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 04-04-2006
PradeepRed PradeepRed is offline
Registered User
  
 

Join Date: Dec 2005
Posts: 25
awk -v in SunOS

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
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:00 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0