Sponsored Content
Top Forums Shell Programming and Scripting After eliminating then save as a string Post 302396987 by fahad.m on Saturday 20th of February 2010 07:41:37 AM
Old 02-20-2010
thanks for your reply
\please note that the before (OctetString): are fix format they will never change
the one after (OctetString): will alawys be changed


Code:
 
[1] private.enterprises.gsi.notification.notifyTrap.ntDispatchId (OctetString): 1014280
[2] private.enterprises.gsi.notification.notifyTrap.ntHostId (OctetString): uattd01
[3] private.enterprises.gsi.notification.notifyTrap.ntMemberName (OctetString): enguard
[4] private.enterprises.gsi.notification.notifyTrap.ntAlertGroup (OctetString): es_ops
[5] private.enterprises.gsi.notification.notifyTrap.ntAlertId (OctetString): 1001
[6] private.enterprises.gsi.notification.notifyTrap.ntAlertSeverity (OctetString): CRITICAL
[7] private.enterprises.gsi.notification.notifyTrap.ntAlertType (OctetString): Log
[8] private.enterprises.gsi.notification.notifyTrap.ntAlertDesc (OctetString): SAF_RTFATM count for SAF_RTFATM
[9] private.enterprises.gsi.notification.notifyTrap.ntAlertText (OctetString): SAF FILE SAF_RTFATM detected a count of 77 records.
[10] private.enterprises.gsi.notification.notifyTrap.ntHostDate (OctetString): 02/16/2010
[11] private.enterprises.gsi.notification.notifyTrap.ntHostTime (OctetString): 14:56
[12] private.enterprises.gsi.notification.notifyTrap.ntCreateDate (OctetString): 02/16/10
[13] private.enterprises.gsi.notification.notifyTrap.ntCreateTime (OctetString): 11:24
[14] private.enterprises.gsi.notification.notifyTrap.14 (OctetString): SAFCHCK
[15] private.enterprises.gsi.notification.notifyTrap.15 (OctetString):
[16] private.enterprises.hp.nm.openView.openViewTrapVars.openViewSourceName.0 (OctetString): 10.0.2.23





i need to save the words tha come after


Code:
[1] private.enterprises.gsi.notification.notifyTrap.ntDispatchId (OctetString):



and before


Code:
[2] private.enterprises.gsi.notification.notifyTrap.ntHostId (OctetString):

as st1 ( st1 variable i need to show it later and use it in case statement.


so in the output and in our case st1=1014280

and the same thing for st2
it will be anything come after
Code:
 
[2] private.enterprises.gsi.notification.notifyTrap.ntHostId (OctetString):

and before
Code:
 
[3] private.enterprises.gsi.notification.notifyTrap.ntMemberName (OctetString):

so at the output the variable st2=uattd01


same thing with st3 st4 st5 st6 st7 st8 st9 st10 till st16
note this string may have space like in st8

output of st8=SAF_RTFATM count for SAF_RTFATM

i hope it is clear right now ...


thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

replace character in a string pattern and save the change in same file

I am facing one problem, can any one please suggest me the command for the same in unix. I am using Ksh. I have a large file with the data that looks like below. "ROTO2-2007f","_US01","9/15/2007","9/21/2007",346492,"NICK, LCD WATCH"97,1,"NAPOLITJ ","BERGER,M Z & CO INC",0.01, ... (2 Replies)
Discussion started by: mihir0011
2 Replies

2. UNIX for Dummies Questions & Answers

Eliminating CR (new lines) from a file.

Hi all, I made a C++ program in dos (in dev-C++) and uploaded it on Solaris box. On opening that file with 'vim' editor i found that there is some extra new lines after each written code line. I tried to find out is the file is in dos or in unix format, with 'file' command,and i got "<file-name>.h:... (4 Replies)
Discussion started by: KornFire
4 Replies

3. Shell Programming and Scripting

save every line in log file with matched string

i have been doing this script to match every line in a current log file (access_log) with strings that i list from a path (consist of 100 of user's name ex: meggae ).. and then make a directory of every string from the text file (/path/meggae/) --->if it matched.. then print every line from the... (3 Replies)
Discussion started by: meggae
3 Replies

4. Shell Programming and Scripting

search a string in a line and save it in a variable

Hi I want to read a file line by line and search for a particular string in each line(say for example string containing @ )and save that string into a variable. Can someone suggest me the way to implement it.I am using K- shell Thanks Ishita (5 Replies)
Discussion started by: Ishita
5 Replies

5. Shell Programming and Scripting

Eliminating output?

Hi Folks, I am writting a shell script for general purpose use.... i have created a function like below:- largest_file() { clear tput cup 20 30 echo please enter the full directory path where you want to search:- tput cup 21 30 read lr_choice1 tput cup 22 30 echo please... (3 Replies)
Discussion started by: rpraharaj84
3 Replies

6. Shell Programming and Scripting

Save cURL verbose output to file or do it like browser "save as.."

hi there ! i have exactly the same problem like this guy here https://www.unix.com/shell-programming-scripting/127668-getting-curl-output-verbose-file.html i am not able to save the curl verbose output.. the sollution in this thread (redirecting stderr to a file) does not work for me.... (0 Replies)
Discussion started by: crabmeat
0 Replies

7. UNIX for Dummies Questions & Answers

Replace a string within 2 points and save it

I've got this xml file <file1> some text here </file1> <file2> some text here </file2> How do I change the text in element file1 to a sentence that I want, defined by variable $sentence. using ksh here. (2 Replies)
Discussion started by: alienated
2 Replies

8. Shell Programming and Scripting

First zero is eliminating in the awk command

I am using something like this in my code nawk 'BEGIN{OFS=FS="|"} {$15='$CalaMig'} {print}' filename actually value of $CalaMig=01234 But its replacing as 1234 in the 15th postion.Its not taking the first zero. can some one help here (1 Reply)
Discussion started by: saj
1 Replies

9. Shell Programming and Scripting

Save value from output of Corestat and save in a list for each core

I am trying to modify the "corestat v1.1" code which is in Perl.The typical output of this code is below: Core Utilization CoreId %Usr %Sys %Total ------ ----- ----- ------ 5 4.91 0.01 4.92 6 0.06 ... (0 Replies)
Discussion started by: Zam_1234
0 Replies

10. Shell Programming and Scripting

Grep a particular string from column eliminating characters at the end.

Hi, So basically I have this file containing query output in seperated columns. In particular column I have the below strings: news news-prio I am trying to grep the string news without listing news-prio aswell. I tried grep "$MSG_TYPE" , grep -w "$MSG_TYPE" , grep... (4 Replies)
Discussion started by: nms
4 Replies
SNMPTRAP(1)							     Net-SNMP							       SNMPTRAP(1)

NAME
snmptrap, snmpinform - sends an SNMP notification to a manager SYNOPSIS
snmptrap -v 1 [COMMON OPTIONS] [-Ci] enterprise-oid agent generic-trap specific-trap uptime [OID TYPE VALUE]... snmptrap -v [2c|3] [COMMON OPTIONS] [-Ci] uptime trap-oid [OID TYPE VALUE]... snmpinform -v [2c|3] [COMMON OPTIONS] uptime trap-oid [OID TYPE VALUE]... DESCRIPTION
snmptrap is an SNMP application that uses the SNMP TRAP operation to send information to a network manager. One or more object identifiers (OIDs) can be given as arguments on the command line. A type and a value must accompany each object identifier. Each variable name is given in the format specified in variables(5). When invoked as snmpinform, or when -Ci is added to the command line flags of snmptrap, it sends an INFORM-PDU, expecting a response from the trap receiver, retransmitting if required. Otherwise it sends an TRAP-PDU or TRAP2-PDU. If any of the required version 1 parameters, enterprise-oid, agent, and uptime are specified as empty, it defaults to 1.3.6.1.4.1.3.1.1 (enterprises.cmu.1.1), hostname, and host-uptime respectively. The TYPE is a single character, one of: i INTEGER u UNSIGNED c COUNTER32 s STRING x HEX STRING d DECIMAL STRING n NULLOBJ o OBJID t TIMETICKS a IPADDRESS b BITS which are handled in the same way as the snmpset command. For example: snmptrap -v 1 -c public manager enterprises.spider test-hub 3 0 '' interfaces.iftable.ifentry.ifindex.1 i 1 will send a generic linkUp trap to manager, for interface 1. OPTIONS
snmptrap takes the common options described in the snmpcmd(1) manual page in addition to the -Ci option described above. SEE ALSO
snmpcmd(1), snmpset(1), variables(5). 4th Berkeley Distribution 08 Feb 2002 SNMPTRAP(1)
All times are GMT -4. The time now is 09:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy