Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Count Number of Alternate Index Post 302651207 by sriky86 on Tuesday 5th of June 2012 07:02:54 AM
Old 06-05-2012
Count Number of Alternate Index

Hello People,

I have got a requirement to count the number of duplicate alternate Indexes present in a C-ISAM/IDXFORMAT(8) file.

Is there any utility that can furnish this information for the file? I am in need of the Alternate Index value and the number of times it appears as Alternate Index.
Eg:
AI_KEY1 1
AI_KEY2 5
AI_KEY3 2

Currently we are running a query on the file (in cyberquery tool) and calculating the count. But it takes long time to execute owing to the size of the file.
Please let me know for any relative informations.

Thanks for your help!!!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

need help getting console driver number(index)

Well, i have a little problem here. I am given device "console" of symbolical type. I do need to get its driver's number (index ?) Your help would be greatly appreciated thx, axujet (1 Reply)
Discussion started by: axujet
1 Replies

2. Shell Programming and Scripting

Write a shell program to find the sum of alternate digits in a given 5-digit number

Hi Can any one please post the answer for the above program.................. (4 Replies)
Discussion started by: banta
4 Replies

3. Shell Programming and Scripting

Number count per number ranges

Hi, I have a question here that need to get advise from all of you. Let say I have a set of data 12347777 12359899 12347677 12360090 12347688 12359979 12359009 12367022 12346677 I need to count the number that appear in each numbering ranges and the output is like below: Prefix ... (5 Replies)
Discussion started by: shirleyeow
5 Replies

4. Filesystems, Disks and Memory

why the inode index of file system starts from 1 unlike array index(0)

why do inode indices starts from 1 unlike array indexes which starts from 0 its a question from "the design of unix operating system" of maurice j bach id be glad if i get to know the answer quickly :) (0 Replies)
Discussion started by: sairamdevotee
0 Replies

5. Shell Programming and Scripting

Sort from start index and end index in line

Hi All, I have a file (FileNames.txt) which contains the following data in it. $ cat FileNames.txt MYFILE17XXX208Sep191307.csv MYFILE19XXX208Sep192124.csv MYFILE20XXX208Sep192418.csv MYFILE22XXX208Sep193234.csv MYFILE21XXX208Sep193018.csv MYFILE24XXX208Sep194053.csv... (5 Replies)
Discussion started by: krish_indus
5 Replies

6. Shell Programming and Scripting

count the number of lines that start with the number

I have a file with contents similar to this. abcd 1234 4567 7666 jdjdjd 89289 9382 92 jksdj 9823 298 I want to write a shell script which count the number of lines that start with the number (disregard the lines starting with alphabets) (1 Reply)
Discussion started by: grajp002
1 Replies

7. Shell Programming and Scripting

how to add the number of row and count number of rows

Hi experts a have a very large file and I need to add two columns: the first one numbering the incidence of records and the another with the total count The input file: 21 2341 A 21 2341 A 21 2341 A 21 2341 C 21 2341 C 21 2341 C 21 2341 C 21 4567 A 21 4567 A 21 4567 C ... (6 Replies)
Discussion started by: juelillo
6 Replies

8. Shell Programming and Scripting

extract the lines by index number

Hi All, I want to extract the lines from file1 by using the index numbers from file2. In example, cat file1.txt 265 ABC 956 ... 698 DFA 456 ... 456 DDD 145 ... 125 DSG 154 ... 459 CGB 156 ... 490 ASF 456 ... 484 XFH 489 ... 679 hgt 481 ... 111 dfg 986 ... 356 vhn 444 ...... (7 Replies)
Discussion started by: senayasma
7 Replies

9. Shell Programming and Scripting

Print smallest negative number with corresponding index from a column

considering the following table: ID col1 col2 col3 col4 1 -16.06801249 13.49785832 -56.57087607 -27.00500526 2 -1.53315720 0.71731735 -42.03602078 -39.78554623 3 -1.53315190 0.71731587 -42.03601548 ... (3 Replies)
Discussion started by: Birda
3 Replies

10. Shell Programming and Scripting

Substitute string with an index number

Objective is to substitute Jan with 01, Feb with 02 and so on. The month will be provided as input. I could construct below awk and it worked. echo Jun | \ awk 'BEGIN{split("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec",mon," ")}{ for (i=1;i<=12;i++){ if ($1==mon) printf("%02d\n",i)} }' ... (4 Replies)
Discussion started by: krishmaths
4 Replies
Judy1(3)						     Library Functions Manual							  Judy1(3)

NAME
Judy1 macros - C library for creating and accessing a dynamic array of bits, using any value of a word as an index. SYNOPSIS
cc [flags] sourcefiles -lJudy #include <Judy.h> int Rc_int; // return code - integer Word_t Rc_word; // return code - unsigned word Word_t Index, Index1, Index2, Nth; Pvoid_t PJ1Array = (Pvoid_t) NULL; // initialize Judy1 array J1S( Rc_int, PJ1Array, Index); // Judy1Set() J1U( Rc_int, PJ1Array, Index); // Judy1Unset() J1T( Rc_int, PJ1Array, Index); // Judy1Test() J1C( Rc_word, PJ1Array, Index1, Index2); // Judy1Count() J1BC(Rc_int, PJ1Array, Nth, Index); // Judy1ByCount() J1FA(Rc_word, PJ1Array); // Judy1FreeArray() J1MU(Rc_word, PJ1Array); // Judy1MemUsed() J1F( Rc_int, PJ1Array, Index); // Judy1First() J1N( Rc_int, PJ1Array, Index); // Judy1Next() J1L( Rc_int, PJ1Array, Index); // Judy1Last() J1P( Rc_int, PJ1Array, Index); // Judy1Prev() J1FE(Rc_int, PJ1Array, Index); // Judy1FirstEmpty() J1NE(Rc_int, PJ1Array, Index); // Judy1NextEmpty() J1LE(Rc_int, PJ1Array, Index); // Judy1LastEmpty() J1PE(Rc_int, PJ1Array, Index); // Judy1PrevEmpty() DESCRIPTION
A Judy1 array is the equivalent of a bit array or bit map. A bit is addressed by an Index (key). The array may be sparse, and the Index may be any word-sized Value. If an index is present, it represents a set bit (a bit set represents an index present). If an index is absent, it represents an unset bit (a bit unset represents an absent index). A Judy1 array is allocated with a NULL pointer Pvoid_t PJ1Array = (Pvoid_t) NULL; Memory to support the array is allocated as bits are set, and released as bits are unset. If the Judy1 pointer (PJ1Array) is NULL, all bits are unset (and the Judy1 array requires no memory). As with an ordinary array, a Judy1 array contains no duplicate indexes. Using the macros described here, rather than the Judy1 function calls, the default error handling sends a message to the standard error and terminates the program with exit(1). For other error handling methods, see the ERRORS section. Because the macro forms are sometimes faster and have a simpler error handling interface than the equivalent functions, they are the pre- ferred way of calling the Judy1 functions. J1S(Rc_int, PJ1Array, Index); // Judy1Set() Set Index's bit in the Judy1 array PJ1Array. Return Rc_int set to 1 if Index's bit was previously unset (successful), otherwise 0 if the bit was already set (unsuccess- ful). J1U(Rc_int, PJ1Array, Index); // Judy1Unset() Unset Index's bit in the Judy1 array PJ1Array; that is, remove Index from the Judy1 array. Return Rc_int set to 1 if Index's bit was previously set (successful), otherwise 0 if the bit was already unset (unsuccess- ful). J1T(Rc_int, PJ1Array, Index); // Judy1Test() Test if Index's bit is set in the Judy1 array PJ1Array. Return Rc_int set to 1 if Index's bit is set (Index is present), 0 if it is unset (Index is absent). J1C(Rc_word, PJ1Array, Index1, Index2); // Judy1Count() Count the number of indexes present in the Judy1 array PJ1Array between Index1 and Index2 (inclusive). Return Rc_word set to the count. A return Value of 0 can be valid as a count, or it can indicate a special case for fully populated array (32-bit machines only). See Judy1Count() for ways to resolve this. To count all indexes present (population) in a Judy1 bit array, use: J1C(Rc_word, PJ1Array, 0, -1); Note: The -1 promotes to the maximum index, that is, all ones. J1BC(Rc_int, PJ1Array, Nth, Index); // Judy1ByCount() Locate the Nth index that is present in the Judy1 array PJ1Array (Nth = 1 returns the first index present). To refer to the last index in a fully populated array (all indexes present, which is rare), use Nth = 0. Return Rc_int set to 1 and Index set to the Nth index if found, otherwise return Rc_int set to 0 (the Value of Index con- tains no useful information). J1FA(Rc_word, PJ1Array); // Judy1FreeArray() Free the entire Judy1 array PJ1Array (much faster than using a J1N(), J1U() loop). Return Rc_word set to the number of bytes freed, and PJ1Array set to NULL. J1MU(Rc_word, PJ1Array); // Judy1MemUsed() Return Rc_word set to the number of bytes of memory currently in use by Judy1 array PJ1Array. This is a very fast routine, and may be used after a J1S() or J1U() call with little performance impact. Judy1 Search Functions The Judy1 search functions allow you to search for set or unset bits in the array. You may search inclusively or exclu- sively, in either forward or reverse directions. All of the search functions use a similar calling sequence. Rc_int is returned set to 1 for a successful search and the found Index is returned. Rc_int is returned set to 0 for an unsuccessful search, and Index contains no useful information. The return code Rc_int must be checked prior to using the returned Index, since a search failure is possible. J1F(Rc_int, PJ1Array, Index); // Judy1First() Search (inclusive) for the first index present that is equal to or greater than the passed Index. (Start with Index = 0 to find the first index in the array.) J1F() is typically used to begin a sorted-order scan of the indexes present in a Judy1 array. J1N(Rc_int, PJ1Array, Index); // Judy1Next() Search (exclusive) for the next index present that is greater than the passed Index. J1N() is typically used to continue a sorted-order scan of the indexes present in a Judy1 array, or to locate a "neighbor" of a given index. J1L(Rc_int, PJ1Array, Index); // Judy1Last() Search (inclusive) for the last index present that is equal to or less than the passed Index. (Start with Index = -1, that is, all ones, to find the last index in the array.) J1L() is typically used to begin a reverse-sorted-order scan of the indexes present in a Judy1 array. J1P(Rc_int, PJ1Array, Index); // Judy1Prev() Search (exclusive) for the previous index present that is less than the passed Index. J1P() is typically used to continue a reverse-sorted-order scan of the indexes present in a Judy1 array, or to locate a "neighbor" of a given index. J1FE(Rc_int, PJ1Array, Index); // Judy1FirstEmpty() Search (inclusive) for the first absent index that is equal to or greater than the passed Index. (Start with Index = 0 to find the first index absent in the array.) J1NE(Rc_int, PJ1Array, Index); // Judy1NextEmpty() Search (exclusive) for the next absent index that is greater than the passed Index. J1LE(Rc_int, PJ1Array, Index); // Judy1LastEmpty() Search (inclusive) for the last absent index that is equal to or less than the passed Index. (Start with Index = -1 to find the last index absent in the array.) J1PE(Rc_int, PJ1Array, Index); // Judy1PrevEmpty() Search (exclusive) for the previous absent index that is less than the passed Index. ERRORS
: See: Judy_3.htm#ERRORS EXAMPLE
In the following example, errors in the J1S() or J1U() calls go to a user-defined procedure, process_malloc_failure. This is not needed when you use the default JUDYERROR() macro, since the default causes your program to exit on all failures, including malloc() failure. #include <stdio.h> #include <Judy.h> int main() // Example program of Judy1 macro APIs { Word_t Index; // index (or key) Word_t Rcount; // count of indexes (or bits set) Word_t Rc_word; // full word return value int Rc_int; // boolean values returned (0 or 1) Pvoid_t PJ1Array = (Pvoid_t) NULL; // initialize Judy1 array Index = 123456; J1S(Rc_int, J1Array, Index); // set bit at 123456 if (Rc_int == JERR) goto process_malloc_failure; if (Rc_int == 1) printf("OK - bit successfully set at %lu ", Index); if (Rc_int == 0) printf("BUG - bit already set at %lu ", Index); Index = 654321; J1T(Rc_int, J1Array, Index); // test if bit set at 654321 if (Rc_int == 1) printf("BUG - set bit at %lu ", Index); if (Rc_int == 0) printf("OK - bit not set at %lu ", Index); J1C(Rcount, J1Array, 0, -1); // count all bits set in array printf("%lu bits set in Judy1 array ", Rcount); Index = 0; J1F(Rc_int, J1Array, Index); // find first bit set in array if (Rc_int == 1) printf("OK - first bit set is at %lu ", Index); if (Rc_int == 0) printf("BUG - no bits set in array "); J1MU(Rc_word, J1Array); // how much memory was used? printf("%lu Indexes used %lu bytes of memory ", Rcount, Rc_word); Index = 123456; J1U(Rc_int, J1Array, Index); // unset bit at 123456 if (Rc_int == JERR) goto process_malloc_failure; if (Rc_int == 1) printf("OK - bit successfully unset at %lu ", Index); if (Rc_int == 0) printf("BUG - bit was not set at %lu ", Index); return(0); } AUTHOR
Judy was invented by Doug Baskins and implemented by Hewlett-Packard. SEE ALSO
Judy(3), JudyL(3), JudySL(3), JudyHS(3), malloc(), the Judy website, http://judy.sourceforge.net, for more information and Application Notes. Judy1(3)
All times are GMT -4. The time now is 09:19 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy