Sponsored Content
Top Forums Shell Programming and Scripting finding lines only between a certain string Post 302248860 by aismann on Monday 20th of October 2008 01:44:37 AM
Old 10-20-2008
The file starts like this

Quote:
root@ckpgpay11core> more /tmp/AIALARM_MSNLA_20080626.txt
MSNLA/UCR40_23MSC_SSNC_EC1C00 6/26/2008 10:50:03 AM
8-15475 KPGCMCS01/AZAHXX#1

DISPEVREC:Event log=String : "AIALARM";
STARTED

Event log records
==================================================================================================== ======================
M-GET CONFIRMATION (
INVOKE IDENTIFIER 102,
LINKED IDENTIFIER 1,
MANAGED OBJECT CLASS alarmRecord,
MANAGED OBJECT INSTANCE {
logId = string : "AIALARM",
logRecordId = number : 341643
},
CURRENT TIME "20080626105008",
ATTRIBUTE LIST {
objectClass alarmRecord,
nameBinding logRecord-log,
managedObjectClass sypObjMAL,
managedObjectInstance { sypAlarmObjectId = "MAL" },
eventType communicationsAlarm,
eventTime "20080608013830",
logRecordId number : 341643,
loggingTime "20080608013832",
packages {
notificationIdentifierPackage,
GAAGDA1C.additionalInformationPackage, eventTimePackage
},
probableCause SAXBAA0C.lossOfSignal,
perceivedSeverity major,
notificationIdentifier 20195,
additionalInformation {
Im using solaris 9
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

help with finding a string

Hello folks I have a text file abcd.txt and has a line starting with number '8'. I have a string in this line starting at position 'a' to position 'b' also this string is a number and have to be reduced by 1. there is also a problem that it has to be padded with zeros to make the string... (2 Replies)
Discussion started by: sandyg
2 Replies

2. Emergency UNIX and Linux Support

Getting last 50 lines after finding a word

Hi All, I have a requirement as below I need find for a string in a log file and once i found that string i need to send a mail.Thsi can be done thru grep and mailx cmnd. Here once i found the string i need to send last 50 lines(up) from where string found. Actually they require to find... (9 Replies)
Discussion started by: pssandeep
9 Replies

3. Shell Programming and Scripting

search string in a file and retrieve 10 lines including string line

Hi Guys, I am trying to write a perl script to search a string "Name" in the file "FILE" and also want to create a new file and push the searched string Name line along with 10 lines following the same. can anyone of you please let me know how to go about it ? (8 Replies)
Discussion started by: sukrish
8 Replies

4. Shell Programming and Scripting

Reading n number of lines after finding string

I am trying to search a file for a value: "Top 30 reject reasons" and want the next 30 lines after that and output in a text file. If I knew the line number, I can use a combination of head and tail commands to get my results, but this doesn't seem to work when I don't have a line number. I... (2 Replies)
Discussion started by: oriqin
2 Replies

5. Shell Programming and Scripting

Finding lines matching the Pattern and their previous lines in a file

Hi, I am trying to locate the occurences of certain pattern like 'Possible network disconnect' in a text file. I can get the actual lines matching the pttern using: grep -w 'Possible network disconnect' file_name. But I am more interested in getting the timing of these events which are... (7 Replies)
Discussion started by: sagarparadkar
7 Replies

6. Shell Programming and Scripting

Finding a string with another string is found

finding a string with another string is found EX: abs c/- i want to find /-, then copy abs. i know it's easy use awk, but my problem is the substr syntax. substr($2,2,2) will give me /- but the conflict is /- is not always the second characted of the second string. (11 Replies)
Discussion started by: engr.jay
11 Replies

7. Shell Programming and Scripting

Printing all lines before a specific string and a custom message 2 lines after

Hello all, I need to print all the lines before a specific string and print a custom message 2 lines after that. So far I have managed to print everything up the string, inclusively, but I can't figure out how to print the 2 lines after that and the custom message. My code thus far is:... (4 Replies)
Discussion started by: SEinT
4 Replies

8. Shell Programming and Scripting

finding least out of selected lines

Hello, I have a file, which looks like: I want to print the row containg "PRO" in second column after comparing and finding the minimum value of fifth column present in all "PRO". and likewise for every other string present in second column. I am using : filename=list... (2 Replies)
Discussion started by: CAch
2 Replies

9. Shell Programming and Scripting

replace (sed?) a string in file with multiple lines (string) from variable

Can someone tell me how I can do this? e.g: a=$(echo -e wert trewt ertert ertert ertert erttert erterte rterter tertertert ert) How do i replace the STRING with $a? I try this: sed -i 's/STRING/'"$a"'/g' filename.ext but this don' t work (2 Replies)
Discussion started by: jforce
2 Replies

10. UNIX for Dummies Questions & Answers

Finding lines with a regular expression, replacing them with blank lines

So the tag for this forum says all newbies welcome... All I want to do is go through my file and find lines which contain a given string of characters then replace these with a blank line. I really tried to find a simple command to do this but failed. Here's what I did come up with though: ... (2 Replies)
Discussion started by: Golpette
2 Replies
snmp_index(3erl)					     Erlang Module Definition						  snmp_index(3erl)

NAME
snmp_index - Abstract Data Type for SNMP Indexing DESCRIPTION
The module snmp_index implements an Abstract Data Type (ADT) for an SNMP index structure for SNMP tables. It is implemented as an ets table of the ordered_set data-type, which means that all operations are O(log n). In the table, the key is an ASN.1 OBJECT IDENTIFIER. This index is used to separate the implementation of the SNMP ordering from the actual implementation of the table. The SNMP ordering, that is implementation of GET NEXT, is implemented in this module. For example, suppose there is an SNMP table, which is best implemented in Erlang as one process per SNMP table row. Suppose further that the INDEX in the SNMP table is an OCTET STRING. The index structure would be created as follows: snmp_index:new(string) For each new process we create, we insert an item in an snmp_index structure: new_process(Name, SnmpIndex) -> Pid = start_process(), NewSnmpIndex = snmp_index:insert(SnmpIndex, Name, Pid), <...> With this structure, we can now map an OBJECT IDENTIFIER in e.g. a GET NEXT request, to the correct process: get_next_pid(Oid, SnmpIndex) -> {ok, {_, Pid}} = snmp_index:get_next(SnmpIndex, Oid), Pid. COMMON DATA TYPES
The following data types are used in the functions below: * index() * oid() = [byte()] * key_types = type_spec() | {type_spec(), type_spec(), ...} * type_spec() = fix_string | string | integer * key() = key_spec() | {key_spec(), key_spec(), ...} * key_spec() = string() | integer() The index() type denotes an snmp index structure. The oid() type is used to represent an ASN.1 OBJECT IDENTIFIER. The key_types() type is used when creating the index structure, and the key() type is used when inserting and deleting items from the structure. The key_types() type defines the types of the SNMP INDEX columns for the table. If the table has one single INDEX column, this type should be a single atom, but if the table has multiple INDEX columns, it should be a tuple with atoms. If the INDEX column is of type INTEGER, or derived from INTEGER, the corresponding type should be integer . If it is a variable length type (e.g. OBJECT IDENTIFIER, OCTET STRING), the corresponding type should be string . Finally, if the type is of variable length, but with a fixed size restriction (e.g. IpAddress), the corresponding type should be fix_string . For example, if the SNMP table has two INDEX columns, the first one an OCTET STRING with size 2, and the second one an OBJECT IDENTIFER, the corresponding key_types parameter would be {fix_string, string} . The key() type correlates to the key_types() type. If the key_types() is a single atom, the corresponding key() is a single type as well, but if the key_types() is a tuple, key must be a tuple of the same size. In the example above, valid keys could be {"hi", "mom"} and {"no", "thanks"} , whereas "hi" , {"hi", 42} and {"hello", "there"} would be invalid. Warning: All API functions that update the index return a NewIndex term. This is for backward compatibility with a previous implementation that used a B+ tree written purely in Erlang for the index. The NewIndex return value can now be ignored. The return value is now the unchanged table identifier for the ets table. The implementation using ets tables introduces a semantic incompatibility with older implementations. In those older implementations, using pure Erlang terms, the index was garbage collected like any other Erlang term and did not have to be deleted when discarded. An ets table is deleted only when the process creating it explicitly deletes it or when the creating process terminates. A new interface delete/1 is now added to handle the case when a process wants to discard an index table (i.e. to build a completely new). Any application using transient snmp indexes has to be modified to handle this. As an snmp adaption usually keeps the index for the whole of the systems lifetime, this is rarely a problem. EXPORTS
delete(Index) -> true Types Index = NewIndex = index() Key = key() Deletes a complete index structure (i.e. the ets table holding the index). The index can no longer be referenced after this call. See the warning note above. delete(Index, Key) -> NewIndex Types Index = NewIndex = index() Key = key() Deletes a key and its value from the index structure. Returns a new structure. get(Index, KeyOid) -> {ok, {KeyOid, Value}} | undefined Types Index = index() KeyOid = oid() Value = term() Gets the item with key KeyOid . Could be used from within an SNMP instrumentation function. get_last(Index) -> {ok, {KeyOid, Value}} | undefined Types Index = index() KeyOid = oid() Value = term() Gets the last item in the index structure. get_next(Index, KeyOid) -> {ok, {NextKeyOid, Value}} | undefined Types Index = index() KeyOid = NextKeyOid = oid() Value = term() Gets the next item in the SNMP lexicographic ordering, after KeyOid in the index structure. KeyOid does not have to refer to an existing item in the index. insert(Index, Key, Value) -> NewIndex Types Index = NewIndex = index() Key = key() Value = term() Inserts a new key value tuple into the index structure. If an item with the same key already exists, the new Value overwrites the old value. key_to_oid(Index, Key) -> KeyOid Types Index = index() Key = key() KeyOid = NextKeyOid = oid() Converts Key to an OBJECT IDENTIFIER. new(KeyTypes) -> Index Types KeyTypes = key_types() Index = index() Creates a new snmp index structure. The key_types() type is described above. Ericsson AB snmp 4.19 snmp_index(3erl)
All times are GMT -4. The time now is 04:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy