Sponsored Content
Top Forums Shell Programming and Scripting Finding Minimum value per Row range of data Post 302313108 by userix on Monday 4th of May 2009 07:44:59 PM
Old 05-04-2009
Finding Minimum value per Row range of data

Here is an example of a file I am working with:

Code:
C  4704   CB 1318   ASP    115    BGRF 1  weak    0.0%  4.33
C  4720   OD 1322   ASP    115    BGRF 1  weak    0.0%  3.71
O  4723   OD 1322   ASP    115    BGRF 1  weak    0.0%  3.48
O  4723   CG 1321   ASP    115    BGRF 1  weak    0.0%  4.34
C  4731   CB 1318   ASP    115    BGRF 1  weak    0.0%  4.28
O  4734   CB 1318   ASP    115    BGRF 1  weak    0.0%  4.19
O  4734   CA 1314   ASP    115    BGRF 1  weak    0.0%  4.15
C  4690   CD 1374   TRP    118    BGRF 1  weak    0.0%  4.37
C  4691   NE 1377   TRP    118    BGRF 1  weak    0.0%  3.99
C  4691   CD 1374   TRP    118    BGRF 1  weak    0.0%  4.16
C  4697   CE 1379   TRP    118    BGRF 1  weak    0.0%  4.27
C  4697   NE 1377   TRP    118    BGRF 1  weak    0.0%  3.13
C  4697   CD 1374   TRP    118    BGRF 1  weak    0.0%  3.61
C  4686   CE 4107   PHE    284    BGRF 1  weak    0.0%  4.07
C  4692   CE 4107   PHE    284    BGRF 1  weak    0.0%  3.90
C  4692   CD 4103   PHE    284    BGRF 1  weak    0.0%  3.89
C  4692   O  4098   PHE    284    BGRF 1  weak    0.0%  3.68
C  4693   CZ 4111   PHE    284    BGRF 1  weak    0.0%  3.98
C  4693   CE 4107   PHE    284    BGRF 1  weak    0.0%  3.30
C  4693   CD 4103   PHE    284    BGRF 1  weak    0.0%  3.69
C  4693   O  4098   PHE    284    BGRF 1  weak    0.0%  3.71
O  4695   CE 4107   PHE    284    BGRF 1  weak    0.0%  3.81
O  4695   CD 4103   PHE    284    BGRF 1  weak    0.0%  3.31
O  4695   CG 4102   PHE    284    BGRF 1  weak    0.0%  4.14
O  4695   CB 4099   PHE    284    BGRF 1  weak    0.0%  4.43
O  4695   C  4097   PHE    284    BGRF 1  weak    0.0%  3.73
O  4695   CA 4095   PHE    284    BGRF 1  weak    0.0%  3.78
C  4690   O  4156   ALA    287    BGRF 1  weak    0.0%  3.83
C  4691   O  4156   ALA    287    BGRF 1  weak    0.0%  3.01
C  4691   C  4155   ALA    287    BGRF 1  weak    0.0%  4.18
C  4692   O  4156   ALA    287    BGRF 1  weak    0.0%  3.01
C  4686   CG 4171   THR    288    BGRF 1  weak    0.0%  3.81
C  4692   CG 4171   THR    288    BGRF 1  weak    0.0%  4.25
C  4693   CG 4171   THR    288    BGRF 1  weak    0.0%  3.54

I want to print out the smallest value in column 11 for each set of unique column 5 and 6 given the data file above.

For instance, from the data file above, I want the following output:

ASP 115 3.48
TRP 118 3.13
PHE 284 3.30
ALA 287 3.01
THR 288 3.54

Basically, for each group of identical column 5 and 6, it finds the smallest value for that set and prints it out. Thanks for any help.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to insert data befor some field in a row of data depending up on values in row

Hi I need to do some thing like "find and insert before that " in a file which contains many records. This will be clear with the following example. The original data record should be some thing like this 60119827 RTMS_LOCATION_CDR INSTANT_POSITION_QUERY 1236574686123083rtmssrv7 ... (8 Replies)
Discussion started by: aemunathan
8 Replies

2. Programming

Select several minimum values from row (MySQL)

Hello there. I've got the query like that SELECT count(tour_id) AS cnt FROM orders JOIN tours ON orders.tour_id=tours.id GROUP BY tour_id The result Is cnt 1 4 2 1 1 Now i have to select all records with minimum values in field "cnt" MySQL function min() returns only one.... (2 Replies)
Discussion started by: Trump
2 Replies

3. Shell Programming and Scripting

Finding minimum value out of specific rows

Hi all, I am having multiple files with the pattern given below: I need to find the minimum value of 5th column if column 1 is x and 2nd column is awh or vbn or ... (20 different strings). the output must be like: Kindly help me to figure out this prob.... Thanks in... (4 Replies)
Discussion started by: CAch
4 Replies

4. Shell Programming and Scripting

Finding minimum value

Hi All, I have multiple files which contains 5 columns and multiple rows..... I want to calculate the minimum value of column 5th, if column 2 is MET, till column 1 comes to the next number. Also it must skip the condition similar to 1st line where column number 1 and 3 are same and... (9 Replies)
Discussion started by: CAch
9 Replies

5. Shell Programming and Scripting

Finding Minimum in a Series

I have two LARGE files of data more than 20,000 line each, file-1 and file-2, and I wish to do the following if possible: file-1 1 2 5 7 9 2 4 6 3 8 9 4 6 8 9 3 2 1 3 1 2 . . . file-2 1 2 3 2 5 7 5 7 3 7 9 4 . (5 Replies)
Discussion started by: ali2011
5 Replies

6. Shell Programming and Scripting

Get string between minimum range value

Deal All, I have millions of input file like this: input 1: disk minimum DISK01 5173 DISK02 5227 DISK03 5284 DISK04 5346 DISK05 5400 DISK06 5456 DISK07 5511 DISK08 5572 . . . input 2: range 5180-5300 (3 Replies)
Discussion started by: attila
3 Replies

7. Shell Programming and Scripting

Finding minimum maximum and average

I am trying to find the minimum maximum and average from one file which has values Received message from https://www.demandmatrix.net/app/dm/xml] in milliseconds. Received message from https://www.demandmatrix.net/app/dm/xml] in milliseconds. Received message from... (5 Replies)
Discussion started by: aroragaurav.84
5 Replies

8. Shell Programming and Scripting

In a row, replace negative sign and find minimum value among four columns

Hi Friends, I have an input file like this chr1 100 200 1 2 3 4 chr1 150 200 4 5 6 7 chr2 300 400 9 6 7 1 chr2 300 410 -10 21 -11 13 chr3 700 900 -21 -22 130 165 Now, my output file is chr1 100 200 1 chr1 150 200 4 chr2 300 400 1 chr2 300 410 10 chr3 700 900 21 Remove... (5 Replies)
Discussion started by: jacobs.smith
5 Replies

9. Shell Programming and Scripting

How to find a minimum value of a row?

input 1 2 3 4 5 2 8 2 1 1 1 4 2 1 5 4 4 4 2 1 3 2 2 6 7 4 5 4 5 5 5 4 3 3 5 I woud like to print a min of each row such that my output would look like 1 1 1 2 3 (5 Replies)
Discussion started by: johnkim0806
5 Replies

10. UNIX for Dummies Questions & Answers

Finding row number along with length of row

I have a fixed length file and I want to find out row number along with row length. I have a program that give me the line length if it satisfy the condition; but i would like to add row number as well? How do I do that? while IFS= read -r line; do if ; then echo ${line} echo... (8 Replies)
Discussion started by: princetd001
8 Replies
DWARF_GET_WEAKS(3)					   BSD Library Functions Manual 					DWARF_GET_WEAKS(3)

NAME
dwarf_get_weaks, dwarf_weak_cu_offset, dwarf_weak_die_offset, dwarf_weak_name_offsets, dwarf_weakname -- retrieve information about weak sym- bols LIBRARY
DWARF Access Library (libdwarf, -ldwarf) SYNOPSIS
#include <libdwarf.h> int dwarf_get_weaks(Dwarf_Debug dbg, Dwarf_Weak **weaks, Dwarf_Signed *nweaks, Dwarf_Error *err); int dwarf_weak_cu_offset(Dwarf_Weak weak, Dwarf_Off *cu_offset, Dwarf_Error *err); int dwarf_weak_die_offset(Dwarf_Weak weak, Dwarf_Off *die_offset, Dwarf_Error *err); int dwarf_weak_name_offsets(Dwarf_Weak weak, char **name, Dwarf_Off *die_offset, Dwarf_Off *cu_die_offset, Dwarf_Error *err); int dwarf_weakname(Dwarf_Weak weak, char **name, Dwarf_Error *err); DESCRIPTION
These functions retrieve information about weak symbols from the lookup tables in the (SGI-specific) ``.debug_weaknames'' section. Informa- tion about weak symbols is returned using opaque descriptors of type Dwarf_Weak. Applications need to use the functions described below to retrieve the name and offset information contained in these descriptors. Function dwarf_get_weaks() retrieves descriptors for all the weak symbols associated with the DWARF debug context specified by argument dbg. The argument weaks should point to a location that will be set to a pointer to an array of Dwarf_Weak descriptors. The argument nweaks should point to a location that will be set to the number of descriptors returned. Function dwarf_weak_cu_offset() returns the offset, relative to the ``.debug_info'' section, of the compilation unit that contains the debug- ging information entry associated with the argument weak. Argument cu_offset should point to a location that will hold the returned offset. Function dwarf_weak_die_offset() retrieves the offset, relative to the ``.debug_info'' section, of the debugging information entry associated with the argument weak, and stores it into the location pointed to by the argument die_offset. Function dwarf_weak_name_offsets() retrieves the name and offsets for the debugging information entry for argument weak. Argument name should point to a location which will be set to a pointer to a NUL-terminated string containing the name of the associated debugging informa- tion entry. Argument die_offset should point to a location which will be set to the offset, relative to the ``.debug_info'' section, of the associated debugging information entry. Argument cu_die_offset should point to a location which will be set to the offset, relative to the ``.debug_info'' section, of the first debugging information entry in the compilation unit associated with argument weak. Function dwarf_weakname() sets the location pointed to by argument name to a pointer to a NUL-terminated string holding the name of the debugging information entry associated with the argument weak. Memory Management The memory area used for the array of Dwarf_Weak descriptors returned in argument weaks by function dwarf_get_weaks() is owned by the DWARF Access Library (libdwarf, -ldwarf). Application code should not attempt to directly free this pointer. Portable code should instead use the function dwarf_weaks_dealloc(3) to indicate that the memory area may be freed. The memory area used for the string returned in the name argument to functions dwarf_weak_name_offsets() and dwarf_weakname() is owned by the DWARF Access Library (libdwarf, -ldwarf). Portable code should indicate that the memory area can be freed using the dwarf_dealloc(3) func- tion. Error Returns If argument err is not NULL, these functions will use it to store error information, in case of an error. RETURN VALUES
On success, these functions returns DW_DLV_OK. In case of an error, they return DW_DLV_ERROR and set the argument err. ERRORS
These functions may fail with the following errors: [DW_DLE_ARGUMENT] One of the arguments cu_die_offset, cu_offset, dbg, die_offset, weak, weaks, name, or nweaks was NULL. [DW_DLE_NO_ENTRY] The DWARF debugging context referenced by argument dbg did not contain information about weak symbols. SEE ALSO
dwarf(3), dwarf_get_cu_die_offset_given_cu_header_offset(3), dwarf_weaks_dealloc(3) BSD
April 10, 2011 BSD
All times are GMT -4. The time now is 08:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy