Searching partial columns and returning maximum as output


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Searching partial columns and returning maximum as output
# 1  
Old 07-29-2008
Searching partial columns and returning maximum as output

Hello,

I am just getting starting with awk and wondering if anyone could help with the following problem.

I have a large file of data, 50,000 rows x 6 columns. I would like to search in blocks of 500 rows for a maximum value in a specific column and compile an output file that prints the complete line for each maximum per 500.

Example, using a 10row x 3column, requested output for blocks of 5 rows:

1 L 3.2
2 F 6.5
3 J 8.4
4 E 5.1
5 A 4.2
6 U 2.2
7 O 6.9
8 H 4.5
9 D 2.3
10 R 21.3

Required Output:

3 J 8.4
10 R 21.3

Any help would be most appreciated,

Rob
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Keep only columns in first two rows based on partial header pattern.

I have this code below that only prints out certain columns from the first two rows (doesn't affect rows 3 and beyond). How can I do the same on a partial header pattern “G_TP” instead of having to know specific column numbers (e.g. 374-479)? I've tried many other commands within this pipe with no... (4 Replies)
Discussion started by: aachave1
4 Replies

2. UNIX for Dummies Questions & Answers

Maximum of the values from the output a query

Following is the output of a command ran inside the script: 2015-01-29-05-38-02 5 2015-01-29-05-38-02 5 2015-01-29-05-38-02 5 2015-01-29-05-38-02 5 2015-01-29-05-38-02 5 2015-01-29-05-38-03 5 2015-01-29-05-38-03 5 2015-01-29-05-38-03 5 2015-01-29-05-38-03 5 2015-01-29-05-38-03 5... (8 Replies)
Discussion started by: Devendra Hupri
8 Replies

3. Shell Programming and Scripting

Returning specific columns upon matching

Hi All, Need help in this requirement. I have fileA with one column and fileB with 26 columns. I need to match the value from fileA with fileB, if matches I have to return that value from fileB, and the next value, 5th and 6th values. NOTE- the matching value's position changes in... (7 Replies)
Discussion started by: vamsikrishna928
7 Replies

4. Shell Programming and Scripting

minimum and maximum from columns

Hi Friends, my input file is this way chr1 100 120 abc chr1 100 121 def chr1 100 122 ghi chr2 240 263 kil chr2 240 276 ghj chr2 255 290 hjh my output chr1 100 122 abc chr2 240 276 kil chr2 255 290 hjh Basically, I want to match on first and second column and then print the... (4 Replies)
Discussion started by: jacobs.smith
4 Replies

5. UNIX for Advanced & Expert Users

Grep returning partial lines due to special characters

Hey guys, I have a file with an ID which I'm using to grep out the original record from another file. Problem is I have special characters in the original file, and grep is returning only a partial record. How can I get around this? Appreciate your help! Pete (3 Replies)
Discussion started by: peteroc
3 Replies

6. Shell Programming and Scripting

AWK - Print partial line/partial field

Hello, this is probably a simple request but I've been toying with it for a while. I have a large list of devices and commands that were run with a script, now I have lines such as: a-router-hostname-C#show ver I want to print everything up to (and excluding) the # and everything after it... (3 Replies)
Discussion started by: ippy98
3 Replies

7. Shell Programming and Scripting

Question about partial searching

Hi there! New user to UNIX scripting. Had a question I was stuck on. I've been trying to make a script(for a larger project) that would search a file(lets say playerlist). the file is already formatted into columns so it may look like First name(1-10) Last Name(11-20) address (21-30) ... (23 Replies)
Discussion started by: Sagramor
23 Replies

8. Shell Programming and Scripting

Partial Column extraction/Process/Repasting changed Columns back to Source file

I have the following requirement. file1.txt (this could contain 5 million rows) ABC 1234 XYZ .... (3000 bytes) QRD 4612 GHT .... (3000 bytes) I need to create file2.txt 1234 4612 I have a EAI process to change file2.txt into file3.txt 4555 3743 Then I would have to use... (0 Replies)
Discussion started by: jostul
0 Replies

9. Shell Programming and Scripting

Searching blocks of rows and returning maximum as output

Hello, I am just getting starting with awk and wondering if anyone could help with the following problem. I have a large file of data, 50,000 rows x 6 columns. I would like to search in blocks of 500 rows for a maximum value in a specific column and compile an output file that prints the... (3 Replies)
Discussion started by: xb_analysis
3 Replies

10. UNIX for Dummies Questions & Answers

Interested in partial command output.

Command output is given to the console. As in the following case - wc -l filename produces following output nn filename From this, I am only interested with nn(rowcount). Cant we simply extract it thr console? I also tried with null device, I know as - /dev/null wc -l filename >... (1 Reply)
Discussion started by: videsh77
1 Replies
Login or Register to Ask a Question
CLASYF(l)								 )								 CLASYF(l)

NAME
CLASYF - compute a partial factorization of a complex symmetric matrix A using the Bunch-Kaufman diagonal pivoting method SYNOPSIS
SUBROUTINE CLASYF( UPLO, N, NB, KB, A, LDA, IPIV, W, LDW, INFO ) CHARACTER UPLO INTEGER INFO, KB, LDA, LDW, N, NB INTEGER IPIV( * ) COMPLEX A( LDA, * ), W( LDW, * ) PURPOSE
CLASYF computes a partial factorization of a complex symmetric matrix A using the Bunch-Kaufman diagonal pivoting method. The partial fac- torization has the form: A = ( I U12 ) ( A11 0 ) ( I 0 ) if UPLO = 'U', or: ( 0 U22 ) ( 0 D ) ( U12' U22' ) A = ( L11 0 ) ( D 0 ) ( L11' L21' ) if UPLO = 'L' ( L21 I ) ( 0 A22 ) ( 0 I ) where the order of D is at most NB. The actual order is returned in the argument KB, and is either NB or NB-1, or N if N <= NB. Note that U' denotes the transpose of U. CLASYF is an auxiliary routine called by CSYTRF. It uses blocked code (calling Level 3 BLAS) to update the submatrix A11 (if UPLO = 'U') or A22 (if UPLO = 'L'). ARGUMENTS
UPLO (input) CHARACTER*1 Specifies whether the upper or lower triangular part of the symmetric matrix A is stored: = 'U': Upper triangular = 'L': Lower triangular N (input) INTEGER The order of the matrix A. N >= 0. NB (input) INTEGER The maximum number of columns of the matrix A that should be factored. NB should be at least 2 to allow for 2-by-2 pivot blocks. KB (output) INTEGER The number of columns of A that were actually factored. KB is either NB-1 or NB, or N if N <= NB. A (input/output) COMPLEX array, dimension (LDA,N) On entry, the symmetric matrix A. If UPLO = 'U', the leading n-by-n upper triangular part of A contains the upper triangular part of the matrix A, and the strictly lower triangular part of A is not referenced. If UPLO = 'L', the leading n-by-n lower triangular part of A contains the lower triangular part of the matrix A, and the strictly upper triangular part of A is not referenced. On exit, A contains details of the partial factorization. LDA (input) INTEGER The leading dimension of the array A. LDA >= max(1,N). IPIV (output) INTEGER array, dimension (N) Details of the interchanges and the block structure of D. If UPLO = 'U', only the last KB elements of IPIV are set; if UPLO = 'L', only the first KB elements are set. If IPIV(k) > 0, then rows and columns k and IPIV(k) were interchanged and D(k,k) is a 1-by-1 diagonal block. If UPLO = 'U' and IPIV(k) = IPIV(k-1) < 0, then rows and columns k-1 and -IPIV(k) were interchanged and D(k-1:k,k-1:k) is a 2-by-2 diagonal block. If UPLO = 'L' and IPIV(k) = IPIV(k+1) < 0, then rows and columns k+1 and -IPIV(k) were interchanged and D(k:k+1,k:k+1) is a 2-by-2 diagonal block. W (workspace) COMPLEX array, dimension (LDW,NB) LDW (input) INTEGER The leading dimension of the array W. LDW >= max(1,N). INFO (output) INTEGER = 0: successful exit > 0: if INFO = k, D(k,k) is exactly zero. The factorization has been completed, but the block diagonal matrix D is exactly singu- lar. LAPACK version 3.0 15 June 2000 CLASYF(l)