Sponsored Content
Top Forums Shell Programming and Scripting Issue using awk to print min values for unique ids Post 303034387 by ncwxpanther on Wednesday 24th of April 2019 11:15:57 AM
Old 04-24-2019
These appear to be the same. Did I miss something?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Awk search for max and min field values

hi, i have an awk script and I managed to figure out how to search the max value but Im having difficulty in searching for the min field value. BEGIN {FS=","; max=0} NF == 7 {if (max < $6) max = $6;} END { print man, min} where $6 is the column of a field separated by a comma (3 Replies)
Discussion started by: Kirichiko
3 Replies

2. Shell Programming and Scripting

print unique values of a column and sum up the corresponding values in next column

Hi All, I have a file which is having 3 columns as (string string integer) a b 1 x y 2 p k 5 y y 4 ..... ..... Question: I want get the unique value of column 2 in a sorted way(on column 2) and the sum of the 3rd column of the corresponding rows. e.g the above file should return the... (6 Replies)
Discussion started by: amigarus
6 Replies

3. Shell Programming and Scripting

AWK script - extracting min and max values from selected lines

Hi guys! I'm new to scripting and I need to write a script in awk. Here is example of file on which I'm working ATOM 4688 HG1 PRO A 322 18.080 59.680 137.020 1.00 0.00 ATOM 4689 HG2 PRO A 322 18.850 61.220 137.010 1.00 0.00 ATOM 4690 CD ... (18 Replies)
Discussion started by: grincz
18 Replies

4. UNIX for Dummies Questions & Answers

[Solved] Print a line using a max and a min values of different columns

Hi guys, I already search on the forum but i can't solve this on my own. I have a lot of files like this: And i need to print the line with the maximum value in last column but if the value is the same (2 in this exemple for the 3 last lines) i need get the line with the minimum value in... (4 Replies)
Discussion started by: MetaBolic0
4 Replies

5. Shell Programming and Scripting

Print unique records in 2 columns using awk

Is it possible to print the records that has only 1 value in 2nd column. Ex: input awex1 1 awex1 2 awex1 3 assww 1 ader34 1 ader34 2 output assww 1 (5 Replies)
Discussion started by: quincyjones
5 Replies

6. Shell Programming and Scripting

How to get min and max values using awk?

Hi, I need your kind help to get min and max values from file based on value in $5 . File1 SP12.3 stc 2240806 2240808 + ID1_N003 ID2_N003T0 SP12.3 sto 2241682 2241684 + ID1_N003 ID2_N003T0 SP12.3 XE 2239943 2240011 + ID1_N003 ID2_N003T0 SP12.3 XE 2240077 2241254 + ID1_N003 ... (12 Replies)
Discussion started by: redse171
12 Replies

7. Shell Programming and Scripting

awk to filter out lines containing unique values in a specified column

Hi, I have multiple files that each contain four columns of strings: File1: Code: 123 abc gfh 273 456 ddff jfh 837 789 ghi u4u 395 File2: Code: 123 abc dd fu 456 def 457 nd 891 384 djh 783 I want to compare the strings in Column 1 of File 1 with each other file and Print in... (3 Replies)
Discussion started by: owwow14
3 Replies

8. Shell Programming and Scripting

awk to print unique text in field

I am trying to use awk to print the unique entries in $2 So in the example below there are 3 lines but 2 of the lines match in $2 so only one is used in the output. File.txt chr17:29667512-29667673 NF1:exon.1;NF1:exon.2;NF1:exon.38;NF1:exon.4;NF1:exon.46;NF1:exon.47 703.807... (5 Replies)
Discussion started by: cmccabe
5 Replies

9. Shell Programming and Scripting

Print count of unique values

Hello experts, I am converting a number into its binary output as : read n echo "obase=2;$n" | bc I wish to count the maximum continuous occurrences of the digit 1. Example : 1. The binary equivalent of 5 = 101. Hence the output must be 1. 2. The binary... (3 Replies)
Discussion started by: H squared
3 Replies

10. UNIX for Beginners Questions & Answers

Print lines based upon unique values in Nth field

For some reason I am having difficulty performing what should be a fairly easy task. I would like to print lines of a file that have a unique value in the first field. For example, I have a large data-set with the following excerpt: PS003,001 MZMWR/ L-DWD// * PS003,001... (4 Replies)
Discussion started by: jvoot
4 Replies
PMC(3)							   BSD Library Functions Manual 						    PMC(3)

NAME
pmc_configure_counter, pmc_start_counter, pmc_stop_counter, pmc_get_num_counters, pmc_get_counter_class, pmc_get_counter_type, pmc_get_counter_value, pmc_get_accumulated_counter_value, pmc_get_counter_class_name, pmc_get_counter_type_name, pmc_get_counter_event_name, pmc_get_counter_event_list -- performance counter interface library LIBRARY
Performance Counters Library (libpmc, -lpmc) SYNOPSIS
#include <pmc.h> int pmc_configure_counter(int ctr, const char *evname, pmc_ctr_t reset_val, uint32_t flags); int pmc_start_counter(int ctr); int pmc_stop_counter(int ctr); int pmc_get_num_counters(void); int pmc_get_counter_class(void); int pmc_get_counter_type(int ctr, int *typep); int pmc_get_counter_value(int ctr, uint64_t *valp); int pmc_get_accumulated_counter_value(int ctr, uint64_t *valp); const char * pmc_get_counter_class_name(int class); const char * pmc_get_counter_type_name(int type); const char * pmc_get_counter_event_name(pmc_evid_t event); const struct pmc_event * pmc_get_counter_event_list(void); DESCRIPTION
The pmc library is an interface to performance monitoring counters available on some CPUs. The pmc library can count events on the following CPU families. Each second-level entry describes a performance counter class. A given class may apply to multiple individual CPU models. Each class has one or more counter types. A CPU may have more than one counter of a given type. Refer to the corresponding processor programmer's manual for more information about individual events. o ARM o Intel i80200 (PMC_CLASS_I80200) There are two types of counters available in this class: PMC_TYPE_I80200_CCNT cycle counter PMC_TYPE_I80200_PMCx performance counter The following events may be counted by a counter of type PMC_TYPE_I80200_CCNT: clock clock-div-64 The following events may be counted by a counter of type PMC_TYPE_I80200_PMCx: insfetch-miss insfetch-stall datadep-stall itlb-miss dtlb-miss branch-taken branch-mispredicted instruction-executed dcachebufffull-stall-time dcachebufffull-stall-count dcache-access dcache-miss dcache-writeback swchange-pc bcu-mem-request bcu-queue-full bcu-queue-drain bcu-ecc-no-elog bcu-1bit-error narrow-ecc-caused-rmw o i386 o Intel i586 (PMC_CLASS_I586) There are two types of counters available in this class: PMC_TYPE_I586_TSC cycle counter PMC_TYPE_I586_PMCx performance counter The following events may be counted by a counter of type PMC_TYPE_I586_PMCx: tlb-data-miss tlb-ins-miss l1cache-ins-miss l1cache-data-miss l1cache-data-miss-read l1cache-data-miss-write l1cache-writeback l1cache-writeback-hit l2cache-data-snoop l2cache-data-snoop-hit mem-read mem-write mem-access mem-access-both-pipes mem-bank-conflicts mem-misalign-ref mem-uncached-read seg-load-any branch branch-btb-hit branch-taken ins-read ins-pipeline-flush ins-executed ins-executed-vpipe ins-stall-agi ins-stall-write ins-stall-data ins-stall-writeline bus-utilization bus-locked bus-io-cycle fpu-flops int-hw break-match0 break-match1 break-match2 break-match3 o Intel i686 (PMC_CLASS_I686) There are two types of counters available in this class: PMC_TYPE_I686_TSC cycle counter PMC_TYPE_I686_PMCx performance counter The following events may be counted by a counter of type PMC_TYPE_I686_PMCx: mem-refs l1cache-lines l1cache-mlines l1cache-mlines-evict l1cache-miss-wait ins-fetch ins-fetch-misses itlb-misses insfetch-mem-stall insfetch-decode-stall l2cache-insfetch l2cache-data-loads l2cache-data-stores l2cache-lines l2cache-lines-evict l2cache-mlines l2cache-mlines-evict l2cache-reqs l2cache-addr-strobes l2cache-data-busy l2cache-data-busy-read bus-drdy-clocks-self bus-drdy-clocks-any bus-lock-clocks-self bus-lock-clocks-any bus-req-outstanding-self bus-req-outstanding-any bus-burst-reads-self bus-burst-reads-any bus-read-for-ownership-self bus-read-for-ownership-any bus-write-back-self bus-write-back-any bus-ins-fetches-self bus-ins-fetches-any bus-invalidates-self bus-invalidates-any bus-partial-writes-self bus-partial-writes-any bus-partial-trans-self bus-partial-trans-any bus-io-trans-self bus-io-trans-any bus-deferred-trans-self bus-deferred-trans-any bus-burst-trans-self bus-burst-trans-any bus-total-trans-self bus-total-trans-any bus-mem-trans-self bus-mem-trans-any bus-recv-cycles bus-bnr-cycles bus-hit-cycles bus-hitm-cycles bus-snoop-stall fpu-flops fpu-comp-ops fpu-except-assist fpu-mul fpu-div fpu-div-busy mem-sb-blocks mem-sb-drains mem-misalign-ref ins-pref-dispatch-nta ins-pref-dispatch-t1 ins-pref-dispatch-t2 ins-pref-dispatch-weak ins-pref-miss-nta ins-pref-miss-t1 ins-pref-miss-t2 ins-pref-miss-weak ins-retired uops-retired ins-decoded ins-stream-retired-packed-scalar ins-stream-retired-scalar ins-stream-comp-retired-packed-scalar ins-stream-comp-retired-scalar int-hw int-cycles-masked int-cycles-masked-pending branch-retired branch-miss-retired branch-taken-retired branch-taken-mispred-retired branch-decoded branch-btb-miss branch-bogus branch-baclear stall-resource stall-partial seg-loads unhalted-cycles mmx-exec mmx-sat-exec mmx-uops-exec mmx-exec-packed-mul mmx-exec-packed-shift mmx-exec-pack-ops mmx-exec-unpack-ops mmx-exec-packed-logical mmx-exec-packed-arith mmx-trans-mmx-float mmx-trans-float-mmx mmx-assist mmx-retire seg-rename-stalls-es seg-rename-stalls-ds seg-rename-stalls-fs seg-rename-stalls-gs seg-rename-stalls-all seg-rename-es seg-rename-ds seg-rename-fs seg-rename-gs seg-rename-all seg-rename-retire o AMD Athlon / K7 (PMC_CLASS_K7) There are two types of counters available in this class: PMC_TYPE_K7_TSC cycle counter PMC_TYPE_K7_PMCx performance counter The following events may be counted by a counter of type PMC_TYPE_K7_PMCx: seg-load-all seg-load-es seg-load-cs seg-load-ss seg-load-ds seg-load-fs seg-load-gs seg-load-hs seg-load-stall l1cache-access l1cache-miss l1cache-refill l1cache-refill-invalid l1cache-refill-shared l1cache-refill-exclusive l1cache-refill-owner l1cache-refill-modified l1cache-load l1cache-load-invalid l1cache-load-shared l1cache-load-exclusive l1cache-load-owner l1cache-load-modified l1cache-writeback l1cache-writeback-invalid l1cache-writeback-shared l1cache-writeback-exclusive l1cache-writeback-owner l1cache-writeback-modified l2cache-access l2cache-tag-read l2cache-tag-write l2cache-inst-read l2cache-inst-load l2cache-data-store l2cache-data-loadmem l2cache-data-write l2cache-data-move l2cache-access-busy l2cache-hit l2cache-miss mem-misalign-ref mem-access mem-access-uc mem-access-wc mem-access-wt mem-access-wp mem-access-wb ins-fetch ins-fetch-miss ins-refill-l2 ins-refill-mem ins-fetch-stall ins-retired ins-empty itlb-miss-l1 itlb-miss-l2 ops-retired branch-retired branch-miss-retired branch-taken-retired branch-taken-miss-retired branch-far-retired branch-resync-retired branch-near-retired branch-near-miss-retired branch-indirect-miss-retired int-hw int-cycles-masked int-cycles-masked-pending break-match0 break-match1 break-match2 break-match3 The pmc library maintains a mapping between event names and the event selector used by the CPU's performance monitoring hardware. The map- ping is described by the following structure: struct pmc_event { const char *name; pmc_evid_t val; }; The pmc_configure_counter() function configures the counter ctr to count the event evname. The initial value of the counter will be set to reset_val, and this value will be loaded back into the counter each time it overflows. There are currently no flags defined for the flags argument. The pmc_start_counter() function enables counting on counter ctr. The pmc_stop_counter() function disables counting on counter ctr. The pmc_get_num_counters() function returns the number of counters present in the CPU. The pmc_get_counter_class() function returns the counter class of the CPU. The pmc_get_counter_type() function places the counter type of counter ctr into *typep. The pmc_get_counter_value() function places the total number of events counted by counter ctr into *valp. The pmc_get_accumulated_counter_value() function places the total number of events counted for the current process and all of its children by counter ctr into *valp. The pmc_get_counter_class_name() function returns the name of the counter class classval. The pmc_get_counter_type_name() function returns the name of the counter type type. The pmc_get_counter_event_name() function returns the name of the event event for the current CPU's performance counter class. The pmc_get_counter_event_list() function returns an array of pmc_event structures, listing the supported event types for the CPU. The array is terminated by and entry who's name member is NULL. RETURN VALUES
The pmc_configure_counter(), pmc_start_counter(), pmc_stop_counter(), pmc_get_counter_type(), pmc_get_counter_value(), and pmc_get_accumulated_counter_value() functions return 0 to indicate success and -1 to indicate failure, in which case errno(2) will be set to indicate the mode of failure. The pmc_get_counter_class_name(), pmc_get_counter_type_name(), pmc_get_counter_event_name(), and pmc_get_counter_event_list() functions return NULL and set errno(2) to indicate failure. SEE ALSO
pmc(1), pmc_control(2), pmc_get_info(2), pmc(9) HISTORY
The pmc library first appeared in NetBSD 2.0. AUTHORS
The pmc library was written by Jason R. Thorpe <thorpej@wasabisystems.com> and contributed by Wasabi Systems, Inc. BSD
August 8, 2002 BSD
All times are GMT -4. The time now is 12:24 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy