Sponsored Content
Special Forums UNIX Desktop Questions & Answers Segregating the data with awk Post 302534832 by itkamaraj on Wednesday 29th of June 2011 12:17:59 AM
Old 06-29-2011
???????
you need a database query ?
Or do you have the input file ?
how input file looks like ?
what output format you expect ?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

data format from (4.56 0.7) -> 4.6(7) awk?!

Hi, I have to manipulate a data file which say reads like this {$index $value $error_on_value} aa 4.56 0.7 bb 123.456 0.00987 cc 987654 321 . . in easily human readable format of type aa 4.6(7) bb 123.456(1) cc 9.877(3)e+05 value rounded to 4.6 with error of 0.7 on the last... (4 Replies)
Discussion started by: ahan
4 Replies

2. Shell Programming and Scripting

Reformatting Data in AWK

Dear AWK Users, I have a data set that is so large (Gigabytes) that it cannot be opened in the vi editor in its entirety. But I can manipulate the entire thing in AWK. It is formatted in a regular manner such that it has the variable descriptions or listings preceeding the variables. The latter... (13 Replies)
Discussion started by: sda_rr
13 Replies

3. Shell Programming and Scripting

Computing data in awk

Hello, I am a newbie in programing. I want to compute the following in awk. I have the following data file: ID Value1 Value2 Value3 sade 0.21 0.45 23 foly 0.31 0.34 43 jude 0.40 0.11 63 jude 0.53 0.32 34 sade 0.67 0.49 66 foly 0.30 0.20 56 I want to take an ID “sade” , then take its... (6 Replies)
Discussion started by: ubeejani
6 Replies

4. Shell Programming and Scripting

AWK help. how to compare a variable with a data array in AWK?

Hi all, i have a data array as follows. array=ertfgj2345 array=456ttygkd . . . array=errdjt3235 so number or elements in the array can varies depending on how big the data input is. now i have a variable, and it is $1 (there are $2, $3 and so on, i am only interested in $1). ... (9 Replies)
Discussion started by: usustarr
9 Replies

5. Shell Programming and Scripting

Help with parsing data with awk , eliminating unwanted data

Experts , Below is the data: --- Physical volumes --- PV Name /dev/dsk/c1t2d0 VG Name /dev/vg00 PV Status available Allocatable yes VGDA 2 Cur LV 8 PE Size (Mbytes) 8 Total PE 4350 Free PE 2036 Allocated PE 2314 Stale PE 0 IO Timeout (Seconds) default --- Physical volumes ---... (5 Replies)
Discussion started by: rveri
5 Replies

6. Shell Programming and Scripting

Data processing using awk

Hello, I have some bitrate data in a csv which is in an odd format and is difficult to process in Excel when I have thousands of rows. Therefore, I was thinking of doing this in bash and using awk as the primary application except that due to its complication, I'm a little stuck. ... (24 Replies)
Discussion started by: shadyuk
24 Replies

7. Shell Programming and Scripting

Grepping data using awk

Hello, I have a data in file 1 2000000024776 2000000026979 2000000033355 2000000036309 2000000041291 2000000042679 2000000067221 and in file 2 its like this 2000000024776 16 2000000026979 16 2000000033355 16 (2 Replies)
Discussion started by: mirwasim
2 Replies

8. Shell Programming and Scripting

awk --> math-operation in data-record and joining with second file data

Hi! I have a pretty complex job - at least for me! i have two csv-files with meassurement-data: fileA ...... (2 Replies)
Discussion started by: IMPe
2 Replies

9. Shell Programming and Scripting

Format Data - awk ..

/clusters/cluster-1/exports/storage-views/M1_CRE03_SV: Name Value ------------------------ --------------------------------------------------------------------------------------------------- caw-enabled true controller-tag - initiators ... (7 Replies)
Discussion started by: greycells
7 Replies

10. Linux

Pivoting data with awk

Hi Friends, I need to pivot data . Below is my source data Source Data PK PRTY_KEY_ID PRTY_SUB_KEY_ID KEY_COL_VAL_TX MTCH_CNFDNCE_RATE 007824822 428844791 1 #Jemmy#Pom#600 Kearsarge Way 100 007824822 429283974 1 #Jemmy#Pom#120 Broadway 100 007824822 429739103 1 #Jemmy#Pom#600 Keae Way#757... (0 Replies)
Discussion started by: patiljeevan3
0 Replies
hsearch(3C)						   Standard C Library Functions 					       hsearch(3C)

NAME
hsearch, hcreate, hdestroy - manage hash search tables SYNOPSIS
#include <search.h> ENTRY *hsearch(ENTRY item, ACTION action); int hcreate(size_t mekments); void hdestroy(void); DESCRIPTION
The hsearch() function is a hash-table search routine generalized from Knuth (6.4) Algorithm D. It returns a pointer into a hash table indicating the location at which an entry can be found. The comparison function used by hsearch() is strcmp() (see string(3C)). The item argument is a structure of type ENTRY (defined in the <search.h> header) containing two pointers: item.key points to the comparison key, and item.data points to any other data to be associated with that key. (Pointers to types other than void should be cast to pointer-to- void.) The action argument is a member of an enumeration type ACTION (defined in <search.h>) indicating the disposition of the entry if it cannot be found in the table. ENTER indicates that the item should be inserted in the table at an appropriate point. Given a duplicate of an existing item, the new item is not entered and hsearch() returns a pointer to the existing item. FIND indicates that no entry should be made. Unsuccessful resolution is indicated by the return of a null pointer. The hcreate() function allocates sufficient space for the table, and must be called before hsearch() is used. The nel argument is an esti- mate of the maximum number of entries that the table will contain. This number may be adjusted upward by the algorithm in order to obtain certain mathematically favorable circumstances. The hdestroy() function destroys the search table, and may be followed by another call to hcreate(). RETURN VALUES
The hsearch() function returns a null pointer if either the action is FIND and the item could not be found or the action is ENTER and the table is full. The hcreate() function returns 0 if it cannot allocate sufficient space for the table. USAGE
The hsearch() and hcreate() functions use malloc(3C) to allocate space. Only one hash search table may be active at any given time. EXAMPLES
Example 1: Example to read in strings. The following example will read in strings followed by two numbers and store them in a hash table, discarding duplicates. It will then read in strings and find the matching entry in the hash table and print it. #include <stdio.h> #include <search.h> #include <string.h> #include <stdlib.h> struct info { /* this is the info stored in table */ int age, room; /* other than the key */ }; #define NUM_EMPL 5000 /* # of elements in search table */ main( ) { /* space to store strings */ char string_space[NUM_EMPL*20]; /* space to store employee info */ struct info info_space[NUM_EMPL]; /* next avail space in string_space */ char *str_ptr = string_space; /* next avail space in info_space */ struct info *info_ptr = info_space; ENTRY item, *found_item; /* name to look for in table */ char name_to_find[30]; int i = 0; /* create table */ (void) hcreate(NUM_EMPL); while (scanf("%s%d%d", str_ptr, &info_ptr->age, &info_ptr->room) != EOF && i++ < NUM_EMPL) { /* put info in structure, and structure in item */ item.key = str_ptr; item.data = (void *)info_ptr; str_ptr += strlen(str_ptr) + 1; info_ptr++; /* put item into table */ (void) hsearch(item, ENTER); } /* access table */ item.key = name_to_find; while (scanf("%s", item.key) != EOF) { if ((found_item = hsearch(item, FIND)) != NULL) { /* if item is in the table */ (void)printf("found %s, age = %d, room = %d ", found_item->key, ((struct info *)found_item->data)->age, ((struct info *)found_item->data)->room); } else { (void)printf("no such employee %s ", name_to_find) } } return 0; } ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
bsearch(3C), lsearch(3C), malloc(3C), string(3C), tsearch(3C), malloc(3MALLOC), attributes(5), standards(5) The Art of Computer Programming, Volume 3, Sorting and Searching by Donald E. Knuth, published by Addison-Wesley Publishing Company, 1973. SunOS 5.10 29 Dec 1996 hsearch(3C)
All times are GMT -4. The time now is 03:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy