Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 06-05-2012
Registered User
 
Join Date: Jun 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
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!!!
Sponsored Links
    #2  
Old 06-05-2012
Skrynesaver's Avatar
Grumpy old geek
 
Join Date: Mar 2011
Location: Éire
Posts: 666
Thanks: 19
Thanked 148 Times in 145 Posts
If I understand your requirement correctly, the following should work.

Code:
cut -d\  -f1 your_file_name | sort | uniq -c

The Following User Says Thank You to Skrynesaver For This Useful Post:
sriky86 (06-05-2012)
Sponsored Links
    #3  
Old 06-05-2012
Registered User
 
Join Date: Jun 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Skrynesaver View Post
If I understand your requirement correctly, the following should work.

Code:
cut -d\  -f1 your_file_name | sort | uniq -c

Thanks. I'll give it a try and let you know if it fits the bill.

Btwn, I have two questions.
1. The file is an indexed file. If i run this command on the DAT part, it will work. Right? (I'll take care of the delimiter and field position in your command)
2. The file is of huge size. (>4 GB). Will this command lock the file when it is run? or is it just a READ mode operation.

Thanks much for your support!!!
    #4  
Old 06-11-2012
Registered User
 
Join Date: Jun 2012
Posts: 4
Thanks: 1
Thanked 0 Times in 0 Posts
The rebuild command automatically picks up the Alternate key/primary key location. (after completing, in the info summery it says whether there is any duplicate primary/alternate key).

But in the cut command we have to manually specify it.

Is there any derivative of rebuild command which gives the number of alternate key value?

Thanks for your help in advance!!!
Sponsored Links
Closed Thread

Tags
index count

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
extract the lines by index number senayasma Shell Programming and Scripting 7 10-28-2011 02:48 PM
count the number of lines that start with the number grajp002 Shell Programming and Scripting 1 02-09-2010 06:49 PM
why the inode index of file system starts from 1 unlike array index(0) sairamdevotee Filesystems, Disks and Memory 0 08-17-2008 03:50 AM
Write a shell program to find the sum of alternate digits in a given 5-digit number banta Shell Programming and Scripting 4 10-30-2006 12:59 AM
need help getting console driver number(index) axujet UNIX for Dummies Questions & Answers 1 06-15-2004 06:33 PM



All times are GMT -4. The time now is 02:44 AM.