Sponsored Content
Full Discussion: awk -v in SunOS
Top Forums Shell Programming and Scripting awk -v in SunOS Post 302070334 by PradeepRed on Tuesday 4th of April 2006 06:14:17 AM
Old 04-04-2006
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
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

SunOS 5.8

I am loging into a SunOS 5.8 box for the first time. I do not see a .profile file in the home directory. Also on the command line when I type a backspace to correct my typing I get a ^H character. Where and how can I fix this? Thanks in advance (5 Replies)
Discussion started by: jxh461
5 Replies

2. UNIX for Advanced & Expert Users

Migration of binary file from Sunos 5.8 to Sunos 5.9

I have compiled binary file using "cc" on SunOS 5.8 and the same binary file i have copied to SunOS 5.9 and it is giving me core dump error.I want to know whether migration of compiled code from lower version to higer version created this problem. how can i solve this problem.I am pasting the core... (1 Reply)
Discussion started by: Arvind Maurya
1 Replies

3. Solaris

SunOS 5.4

Hi, I Hope you can help me with my problem. I need to have an installation CD of this version. Is there any site you can recommend that I can download an image of this OS? Thanks and God Bless!!! (6 Replies)
Discussion started by: mr_balodoy
6 Replies

4. Solaris

Looking for help with SunOS 5.6

Hey all, I've got my hands on 10 SunOS 5.6 SPARCStation 20 machines and I'm looking to get them up and running. They're all in various states of disrepair but I've got them all to a state where the hardware is working and the machine will at least attempt to boot. I've only used Solaris as a... (1 Reply)
Discussion started by: kevpatts
1 Replies

5. Solaris

Any patches for SunOS 5.11?

I need patch against the I_PEEK Local Kernel memory Leak Exploit But i'm unable to find any patches for Solaris 5.11, and smpatch is no longer supported... So, do you have any suggestions how to patch my system? Thanks. (4 Replies)
Discussion started by: static
4 Replies

6. Solaris

New to SunOS...

...and I'm having an issue with memory usage. I got an alert from our sun management console that the box is at 90% memory usage. I need to know what's eating up the memory as this particular box has 16GB of RAM. (3 Replies)
Discussion started by: bbbngowc
3 Replies

7. Solaris

SunOS 5.8 vs 5.10

Hi, I am bulding a path to open files like this \path\values\file.xxx This path is opened in an IE browser window and opens the file/document I am trying to see. I mean it opens a pdf document or it promps you to "save" or "open" the specific file (if it's a .xml, .doc, .html). I was using... (1 Reply)
Discussion started by: hcibl_javok
1 Replies

8. Solaris

SunOS 5.6

Hi, I called Sun and they said they no longer sell SunOS 5.6. I desperately need a CD-ROM of the install CD to perform maintenance work on a server. Does anyone know where to get one or know someone who can make me a copy? (2 Replies)
Discussion started by: mojoman
2 Replies

9. Shell Programming and Scripting

array and awk match function in SunOS 5.10

Hi Experts, Need help in writing a shell script in SunOS 5.10. I want to use array but it is not running in SunOs where as it is running in unix. pls help Want to print the alue store in array as below but it is giving error. p=1 p=6 p=15 p=20 for i in 1 2 3 4 do echo ${p} done ... (2 Replies)
Discussion started by: forroughuse
2 Replies

10. UNIX for Advanced & Expert Users

awk variable regexp works in AIX but not in SunOS?

Using awk variables for regular expressions is working for me in AIX. It is failing for me in SunOS. I don't know why. Can someone explain and/or suggest a fix for the SunOS version? Here is a little test script. It runs fine in AIX: $ cat test.ksh #! /bin/ksh print "Executed on OS: $(... (6 Replies)
Discussion started by: charles_n_may
6 Replies
fence_mcdata(8) 					      System Manager's Manual						   fence_mcdata(8)

NAME
fence_mcdata - I/O Fencing agent for McData FC switches SYNOPSIS
fence_mcdata [OPTION]... DESCRIPTION
fence_mcdata is an I/O Fencing agent which can be used with McData FC switches. It logs into a McData switch via telnet and disables a specified port. Disabling the port which a machine is connected to effectively fences that machine. Lengthy telnet connections to the switch should be avoided while a GFS cluster is running because the connection will block any necessary fencing actions. fence_mcdata accepts options on the command line as well as from stdin. fenced sends parameters through stdin when it execs the agent. fence_mcdata can be run by itself with command line options which is useful for testing. After a fence operation has taken place the fenced machine can no longer connect to the McData FC switch. When the fenced machine is ready to be brought back into the GFS cluster (after reboot) the port on the McData FC switch needs to be enabled. This can be done by running fence_mcdata and specifying the enable action. Vendor URL: http://www.brocade.com OPTIONS
-a IPaddress IP address of the switch. -h Print out a help message describing available options, then exit. -l login Username name for the switch. -n port The port number to disable on the switch. -o action The action required. disable (default) or enable. -p password Password for login. -S path Full path to an executable to generate the password for login. -q Quiet mode: print only error messages. -V Print out a version message, then exit. STDIN PARAMETERS
agent = < param > This option is used by fence_node(8) and is ignored by fence_mcdata. ipaddr = < hostname | ip > IP address or hostname of the switch. login = < param > Login name. option = < param > The action required. disable (default) or enable. passwd = < param > Password for login. passwd_script = < param > Full path to an executable to generate the password for login. port = < param > The port number to disable on the switch. SEE ALSO
fence(8), fence_node(8) fence_mcdata(8)
All times are GMT -4. The time now is 02:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy