Sponsored Content
Top Forums Shell Programming and Scripting Select only top "N" records based on column value Post 302470306 by asandy1234 on Tuesday 9th of November 2010 05:36:12 PM
Old 11-09-2010
Quote:
Originally Posted by asandy1234
Again and again you are proving that you are a genius. I really appreciate your valueble contribution.

Thanks once again...
Hi radoulov,
I've one final query,in the logic to remove records whose count is more than 'n' based on column4 if I've to include one more column say column2 will the query change as count[$2,$4]++ < n ?

Thanks,
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Commands on Digital Unix equivalent to for "top" and "sar" on other Unix flavour

Hi, We have a DEC Alpha 4100 Server with OSF1 Digital Unix 4.0. Can any one tell me, if there are any commands on this Unix which are equivalent to "top" and "sar" on HP-UX or Sun Solaris ? I am particularly interested in knowing the CPU Load, what process is running on which CPU, etc. ... (1 Reply)
Discussion started by: sameerdes
1 Replies

2. UNIX for Dummies Questions & Answers

Select records based on search criteria on first column

Hi All, I need to select only those records having a non zero record in the first column of a comma delimited file. Suppose my input file is having data like: "0","01/08/2005 07:11:15",1,1,"Created",,"01/08/2005" "0","01/08/2005 07:12:40",1,1,"Created",,"01/08/2005"... (2 Replies)
Discussion started by: shashi_kiran_v
2 Replies

3. Debian

Debian: doubt in "top" %CPU and "sar" output

Hi All, I am running my application on a dual cpu debian linux 3.0 (2.4.19 kernel). For my application: <sar -U ALL> CPU %user %nice %system %idle ... 10:58:04 0 153.10 0.00 38.76 0.00 10:58:04 1 3.88 0.00 4.26 ... (0 Replies)
Discussion started by: jaduks
0 Replies

4. AIX

AIX 5.3 - Discrepancies between "top" and "vmstat"

Can someone explain the differences I'm seeing below in TOP and VMSTAT commands on my AIX 5.3 server? Thanks! CPUs: 4; load averages: 0.86, 0.97, 0.97 18:09:26 926 processes: 4 stopped, 922 running CPU states: 78.4% idle, 8.5% user, 12.6% kernel, 0.3% wait Memory: 23680M Total.... (1 Reply)
Discussion started by: troym72
1 Replies

5. Shell Programming and Scripting

"Join" or "Merge" more than 2 files into single output based on common key (column)

Hi All, I have working (Perl) code to combine 2 input files into a single output file using the join function that works to a point, but has the following limitations: 1. I am restrained to 2 input files only. 2. Only the "matched" fields are written out to the "matched" output file and... (1 Reply)
Discussion started by: Katabatic
1 Replies

6. Shell Programming and Scripting

AWK for multiple line records RS="^" FS="#"

I have to pull multiple line records with ^ as the record separator(RS)... # should be my field separator (FS)... Sample record is: ^-60#ORA-00060: deadlock detected while waiting for resource ORA-00001: unique constraint (SARADM.TCKNUM_PK) violated#PROC:AVAILABLE_FOR_GETNXTTIC#02/27/2012... (7 Replies)
Discussion started by: Vidhyaprakash
7 Replies

7. Shell Programming and Scripting

Substituting comma "," for dot "." in a specific column when comma"," is a delimiter

Hi, I'm dealing with an issue and losing a lot of hours figuring out how i would solve this. I have an input file which looks like this: ('BLABLA +200-GRS','Serviço ','TarifaçãoServiço','wap.bla.us.0000000121',2985,0,55,' de conversão em escada','Dia','Domingos') ('BLABLA +200-GRR','Serviço... (6 Replies)
Discussion started by: poliver
6 Replies

8. Shell Programming and Scripting

awk based script to print the "mode(statistics term)" for each column in a data file

Hi All, Thanks all for the continued support so far. Today, I need to find the most occurring string/number(also called mode in statistics terminology) for each column in a data file (.csv type). For one column of data(1.txt) like below Sample 1 2 2 3 4 1 1 1 2 I can find the mode... (6 Replies)
Discussion started by: ks_reddy
6 Replies

9. Shell Programming and Scripting

Choosing between repeated entries based on the "absolute values" of a column

Hello, I was looking for a way to select between the repeated entries (column1) based on the values of absolute values of column 3 (larger value). For example if the same gene id has FC value -2 and 1, I should get the output as -2. Kindly help. GeneID Description FC ... (2 Replies)
Discussion started by: Sanchari
2 Replies

10. UNIX for Beginners Questions & Answers

Extract delta records using with "comm" and "sort" commands combination

Hi All, I have 2 pipe delimited files viz., file_old and file_new. I'm trying to compare these 2 files, and extract all the different rows between them into a new_file. comm -3 < sort file_old < sort file_new > new_file I am getting the below error: -ksh: sort: cannot open But if I do... (7 Replies)
Discussion started by: njny
7 Replies
Ace::Browser::SearchSubs(3pm)				User Contributed Perl Documentation			     Ace::Browser::SearchSubs(3pm)

NAME
Ace::Browser::SearchSubs - Subroutines for AceBrowser search scripts SYNOPSIS
use Ace; use Ace::Browser::AceSubs; use Ace::Browser::SearchSubs; use CGI qw(:standard); my $form = p(start_form, textfield(-name=>'query'), end_form); AceSearchTable('Search for stuff',$form); ... my $query = param('query'); my $offset = AceSearchOffset; my ($objects,$count) = do_search($query,$offset); AceResultsTable($objects,$count,$offset,'Here are results'); DESCRIPTION
Ace::Browser::SearchSubs exports a set of constants and subroutines that are useful for creating AceBrowser search scripts. CONSTANTS This package exports the following constants: MAXOBJECTS The maximum number of objects that can be displayed per page. SEARCH_ICON An icon to use for search links. This is deprecated. Use Configuration->Search_icon instead. FUNCTIONS These functions are exported: $offset = AceSearchOffset() When the user is paging back and forth among a multi-page list of results, this function returns the index of the first item to display. AceSearchTable([{hash}],$title,@contents) Given a title and the HTML contents, this formats the search into a table and gives it the background and foreground colors used elsewhere for searches. The formatted search is then printed. The HTML contents are usually a fill-out form. For convenience, you can provide the contents in multiple parts (lines or elements) and they will be concatenated together. If the first argument is a hashref, then its contents will be passed to start_form() to override the form arguments. AceResultsTable($objects,$count,$offset,$title) This subroutine formats the results of a search into a pageable list and prints out the resulting HTML. The following arguments are required: $objects An array reference containing the objects to place in the table. $count The total number of objects. $offset The offset into the array, as returned by AceSearchOffset() $title A title for the table. The array reference should contain no more than MAXOBJECTS objects. The AceDB query should be arranged in such a way that this is the case. A typical idiom is the following: my $offset = AceSearchOffset(); my $query = param('query'); my $count; my @objs = $db->fetch(-query=> $query, -count => MAXOBJECTS, -offset => $offset, -total => $count ); AceResultsTable(@objs,$count,$offset,'Here are the results'); BUGS
Please report them. SEE ALSO
Ace::Object, Ace::Browser::SiteDefs, Ace::Browsr::AceSubs, the README.ACEBROWSER file. AUTHOR
Lincoln Stein <lstein@cshl.org>. Copyright (c) 2001 Cold Spring Harbor Laboratory This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty. perl v5.14.2 2006-11-01 Ace::Browser::SearchSubs(3pm)
All times are GMT -4. The time now is 11:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy