Sponsored Content
Full Discussion: find the field number
Top Forums Shell Programming and Scripting find the field number Post 302470470 by kykyboss023 on Wednesday 10th of November 2010 08:57:27 AM
Old 11-10-2010
find the field number

######################## SOLVED ##################

Hi

I have a header file like the following and the field "IDENTIFIER" can be at any possition on this line,
The line can containt a variable number of field, not alway the same depending of the header file i use

Code:
 
BAS,FastZeroSurfUNIT,ZeroSurfCAL,FastZeroSurfDAYC,IDENTIFIER,FunctionIdFLAG

I try to write a fonction that will return me the position of the collum "IDENTIFIER"


any idea ?

Last edited by kykyboss023; 11-10-2010 at 12:03 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to search a number in a certain field

Hello, I have a file that looks like this: num11 num12 num13 word1 num21 num22 num23 word2 num31 num32 num33 word3 . . . I would like to search for the lines that contain a given number, but I need to narrow the search only to the first field, that means that the number has to... (4 Replies)
Discussion started by: shira
4 Replies

2. Shell Programming and Scripting

Find top N values for field X based on field Y's value

I want to find the top N entries for a certain field based on the values of another field. For example if N=3, we want the 3 best values for each entry: Entry1 ||| 100 Entry1 ||| 95 Entry1 ||| 30 Entry1 ||| 80 Entry1 ||| 50 Entry2 ||| 40 Entry2 ||| 20 Entry2 ||| 10 Entry2 ||| 50... (1 Reply)
Discussion started by: FrancoisCN
1 Replies

3. Shell Programming and Scripting

Sorting on two fields time field and number field

Hi, I have a file that has data in it that says 00:01:48.233 1212 00:01:56.233 345 00:09:01.221 5678 00:12:23.321 93444 The file has more line than this but i just wanted to put in a snippet to ask how I would get the highest number with time stamp into another file. So from the above... (2 Replies)
Discussion started by: pat4519
2 Replies

4. Shell Programming and Scripting

Count number of occurences of a character in a field defined by the character in another field

Hello, I have a text file with n lines in the following format (9 column fields): Example: contig00012 149606 G C 49 68 60 18 c$cccccacccccccccc^c I need to count the number of lower-case and upper-case occurences in column 9, respectively, of the... (3 Replies)
Discussion started by: s052866
3 Replies

5. Shell Programming and Scripting

Adding total of first field for each number in the second field

Dears, I need a script or command which can find the unique number from the second filed and against that number it adds the total of first field . 17215630 , 0 907043 ,1 201050 ,10 394149 ,4 1964 ,9 17215630, 0 907043 ,1 201050, 10 394149 ,4 1964 ,9 1234234, 55 23 ,100 33 ,67 ... (2 Replies)
Discussion started by: shary
2 Replies

6. Shell Programming and Scripting

Help with number field manipulation

I have a comma separated file containing numbers, I would like to read the file and divide each number by 1024 and create an output file. Input file : 50312.00,3434.05, ,3433.34,124344.00,434343.00, , , Output file: 49.13,3.35,3.35,0,12.05,424.16,0,0 Please click this link: How to... (2 Replies)
Discussion started by: inditopgun
2 Replies

7. Shell Programming and Scripting

Get the changed field number

HI, I have two files and contains many Fields or columns with | (pipe) delimitor, wanted to compare both the files and get only unmatched perticular fields number. ex: first.txt 111 |abc| 230| hbc | bb2 | cs second.txt 111 |abc |230 |abn | bb2 | fp Here the different data in two... (2 Replies)
Discussion started by: prawinmca
2 Replies

8. Shell Programming and Scripting

Changed Field Number

HI, I have two files and contains many Fields or columns with | (pipe) delimitor, wanted to compare both the files and get only unmatched perticular fields number. ex: first.txt 1 | 2 | 3 111 |abc| 230 hbc | bb2 | cs second.txt 1 | 2 | 3 111 |abc |230 abn | bb2 | fp Here the... (7 Replies)
Discussion started by: prawinmca
7 Replies

9. Shell Programming and Scripting

awk to find number in a field then print the line and the number

Hi I want to use awk to match where field 3 contains a number within string - then print the line and just the number as a new field. The source file is pipe delimited and looks something like 1|net|ABC Letr1|1530||| 1|net|EXP_1040 ABC|1121||| 1|net|EXP_TG1224|1122||| 1|net|R_North|1123|||... (5 Replies)
Discussion started by: Mudshark
5 Replies

10. Shell Programming and Scripting

Different field number in the file

Hello Friends I have a data file which is comma seperate (,) where i am expecting 2 column but there are number of time when file comes with data having more than 2 column. I want to check which line has more columns 20141115,15/11/2014 20141129,29/11/2014 20141003,03/10/2014... (4 Replies)
Discussion started by: guddu_12
4 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 05:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy