Sponsored Content
Top Forums Shell Programming and Scripting How to print values that are greater than 0.1 in at least 80% of the samples? Post 302940501 by RudiC on Monday 6th of April 2015 02:33:30 PM
Old 04-06-2015
Try
Code:
awk     'NR==1  {for (i=1; i<=NF; i++)  {GRCNT[$i]++
                                         if (!GRMIN[$i]) GRMIN[$i]=i+1
                                         GRMAX[$i]=i+1
                                        }
                 if (debug) for (i in GRCNT) print "Verteilung: ", $1, i, GRCNT[i], GRMIN[i], GRMAX[i]
                }

         NR>2   {for (gc in GRCNT)      {TOT[gc]=0
                                         for (i=GRMIN[gc];i<=GRMAX[gc];i++)
                                                {TOT[gc]+=($i>0.1)
                                                 if (debug) print $1, gc, i, $i, ($i>0.1)
                                                }
                                        }

                 for (gc in TOT)        {if (debug) print NR, $1, gc, GRCNT[gc], TOT[gc]
                                         if (TOT[gc] >= GRCNT[gc] * 0.8) {print; CNT[gc]++; break}
                                        }
                }
         END    {for (c in CNT) print c, CNT[c]}
        ' file

This User Gave Thanks to RudiC For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Finding absolute values greater than a certain value

Hi I am posting here for the first time. I am trying to write a script that reads a data file and tries to determine if any absolute values that are above 0.5 I was thinking it ought to be possible to do this with awk somehow. Are there any suggestions before I start reinventing the wheel? ... (4 Replies)
Discussion started by: jackygrahamez
4 Replies

2. UNIX for Dummies Questions & Answers

Print lines which are greater than

I have a file which has a list of titles and then 14 lines afterwards. I need to find the 1 through 14 lines which are greater than 15k and print the title and the line which matched. Sample before: ABC.CDE.NORTH.NET 1:18427 2:302 3:15559 4:105 5:5 6:2 7:2 8:2 9:4 10:2 11:17 12:2... (3 Replies)
Discussion started by: numele
3 Replies

3. Homework & Coursework Questions

Problem with awk,not able print the file that is greater than 3000 bytes.

My Script: #!/bin/sh date=`date +%y%m%d -d"1 day ago"` in_dir=/vis/logfiles/to_solmis cp `grep -il ST~856~ $inbound_dir/*$date*` /vis/sumit/in_ASN/ for i in /vis/sumit/in_ASN/* do mkdir -p /vis/sumit/inboundasns.$date cp `echo $i`... (1 Reply)
Discussion started by: shrima.pratima
1 Replies

4. Shell Programming and Scripting

AWK/SED print if 2nd character in a column is greater than 0

We have an access log where column 8 displays the time in seconds like below: Tj8nQAoNgwsAABov9cIAAAFL - 10.13.131.80 - - (0) - "GET /aaaaa/bbbb/bbbb where column 8 is printed (0). We are trying to find how many entries are there that has column 8 greater than 0. Remember $8 is (0) and not... (5 Replies)
Discussion started by: spacemtn5
5 Replies

5. Shell Programming and Scripting

Compare values in two files. For matching rows print corresponding values from File 1 in File2.

- I have two files (File 1 and File 2) and the contents of the files are mentioned below. - I am trying to compare the values of Column1 of File1 with Column1 of File2. If a match is found, print the corresponding value from Column2 of File1 in Column5 of File2. - I tried to modify and use... (10 Replies)
Discussion started by: Santoshbn
10 Replies

6. Shell Programming and Scripting

awk to get values greater than

data.txt August 09 17:16 2013 August 09 17:17 2013 August 09 17:19 2013 August 09 17:20 2013 August 09 17:21 2013 August 09 17:22 2013 August 09 17:23 2013 August 09 17:24 2013 to print from a point in this file, to the end of the file, i type: awk '/August 09 17:22/,0' data.txt. ... (1 Reply)
Discussion started by: SkySmart
1 Replies

7. Shell Programming and Scripting

Help me to find a greater than or smaller than values

Hi, i need to find one of the value from my file is in between two numbers, that is the value is greater than 34 and smaller than 50, Ex: File.txt col1 col2 col3 col4 1 Name1 93 w 2 Name2 94 a 3 Name3 32 b 4 Name4 45 x 5 Name5 50 y 6 Name6 49 z here i need to find col3 values are... (7 Replies)
Discussion started by: Shenbaga.d
7 Replies

8. Shell Programming and Scripting

Calculating mean for samples 1-3 4-6 etc.

Hi. I have a LOOONG list of samples but I am not sure how to write the loop/script to calculate the mean... I normally use awk... ...................MEAN Sample1 25.82 40.61333 Sample1 47.6 Sample1 48.42 Sample2 54.03 54.12 Sample2 53.98 Sample2 54.35 etc..... I would like to... (4 Replies)
Discussion started by: danieladna
4 Replies

9. Red Hat

EX300 - Samples Needed

May i have some samples of EX300 exam cert.? pls help ---------- Post updated at 01:12 AM ---------- Previous update was at 12:52 AM ---------- Who can share new RHCE V7 EX300 exam dumps/EX300 exam questions? ---------- Post updated at 03:48 AM ---------- Previous update was at 01:12... (1 Reply)
Discussion started by: ded325
1 Replies

10. UNIX for Beginners Questions & Answers

How to replace the field values, which are greater than the specified value with TRUE?

I have a csv file as given below, org1 org2 org3 org4 org5 gene1 100 80 90 80 150 gene2 30 70 50 50 115 gene3 40 120 60 40 105 gene4 20 72 40 60 20 I need to replace the fields are having values greater than 100 with "TRUE". I used the following commands to replace... (6 Replies)
Discussion started by: dineshkumarsrk
6 Replies
vmstat(1)						      General Commands Manual							 vmstat(1)

NAME
vmstat - Displays virtual memory statistics SYNOPSIS
vmstat interval [count] vmstat [-D | -f | -i | -M | -p | -P | -r rad_id | -R | -s | -w] The vmstat command displays system statistics for virtual memory, processes, trap, and CPU activity. OPTIONS
Displays debugging information if kmem_debug is set. Displays only statistics about the number of forks since system startup (see the fork() call). Displays the following virtual memory statistics: # vmstat -i Virtual Memory Statistics: (pagesize = 8192) procs memory pages intr cpu r w u act free wire fault cow zero react pin pout in sy cs us sy id 2 82 29 23K 12K 4906 3M 963K 834K 620 710K 0 73 30 391 0 2 98 Displays information about memory usage by buckets. This information can be used for kernel debugging. Displays statistics for the vm and ubc subsystems for all Resource Affinity Domains (RADs). Typical output (derived from a single-RAD, single-CPU server) is shown in the following example: # vmstat -p Total RADs: 1 Total CPUs: 1 Total Ticks: 512 36441297 VM faults 1677 VM kfaults 2115850 VM cowcopy 1677 VM kzfod 0 VM pagesteal 0 VM prewrites 0 VM anon_prewrites 0 VM swap_prewrites 0 VM cleanrecs 0 VM swaprecs 0 VM lmsteal 0 VM lmstealwins 0 VM ffl 0 VM pout_scan 0 VM pout_pagescan 0 VM pout_call 0 VM pout 0 VM pout_target 0 VM pout_burst 12548 VM act_scans 12548 VM act_moves 0 VM lock_fails 0 VM migrations 2547665 VM TOT cowfaults 3813949 VM TOT zfod 0 VM TOT iowrites 0 VM TOT pgwrites 26823910 VM TOT ioreads 0 VM TOT pgreads 1423 VM TOT reactivate 0 UBC allocscans 0 UBC alloceol 0 UBC allocpush 0 UBC allocstole 0 UBC allocseq 0 UBC wacalls 0 UBC wascans 0 UBC waeol 0 UBC prges 0 UBC prgscans 0 UBC prgeol 0 UBC prgburst 0 UBC prgfree 0 UBC mmapfree 79566 UBC wdeny 0 UBC hardsteals 0 UBC stealscans 0 UBC dirtywra 0 UBC reclaim 0 UBC pagesteal 42127497 UBC lookups 41985615 UBC lookuphits 0 UBC ffl 0 UBC lmsteal 0 UBC lmstealwins 0 UBC seqdrain 144957 UBC TOT alloc 0 UBC TOT iowrites 0 UBC TOT reactivate 0 UBC TOT pgwrites Displays the following accumulated statistics about physical memory use: Sum of the total physical memory in the machine. This statistic describes how physical memory is clustered. It shows where memory is being used (pal, os, and nvram), the starting and ending pageframes, and the total amount of memory used. This statistic shows a breakdown of physical memory used by the operating system (such as text, data, and bss). It contains the starting and ending pageframes, memory usage per category, and total memory used. This statistic provides snap- shot of where managed physical memory resides when the vmstat command was run. It indicates the the number of pages in the free, active and inactive queues, the number of wired pages, and the number of pages held in the unified buffer cache (UBC). This statistic describes the physical pages that are wired in memory. The fields show the number of wired pages in anonymous(vm) memory, the UBC, pages used for meta data, the kernel malloc pools, contiguous memory, and pages used for page table entries (ptes). The display typically shows: vm and ubc wired pages meta data, malloc, and contig pages user, kernel, and free ptepages. Displays virtual memory statistics for the specified Resource Affinity Domain (RAD) only. The rad_id is an integer assigned automatically by the system. Typical output is shown in the follow- ing example, which has been reformatted for ease of reference: # vmstat -r 0 Virtual Memory Statistics: (pagesize = 8192) procs memory pages RAD r w u st sw act actv actu acti free wire wirv wiru fault 0 2 157 27 0 0 31K 4928 18K 8813 24K 6544 3015 0 36M intr cpu cow zero react pin pout in sy cs us sy id 2M 3M 1423 26M 0 102 249 229 0 1 99 Displays information for all Resource Affinity Domains (RADs). Typical output is shown under the -r option. Displays the following accumulated statistics along with the page size: Total number of pages that are currently in use but can be used for paging. Total number of VM pages that are allocated but are most likely to be used for paging. Total number of unreferenced (clean) pages that are available for use. Total number of pages that are currently in use and cannot be used for paging (not a real list). Number of address translation faults that have occurred. Number of copy-on-write page faults, which occur if the requested page is shared by a parent process and one or more child processes (using the fork function) and if one of the processes needs to modify the page. In this case, VM loads a new address into the translation buffer and copies the contents of the requested page into the new address for modification by the process. Number of zero-filled-on-demand page faults, which occur if VM cannot find the page in the inter- nal data structures and if the requested page is new and has never been referenced. In this case, VM initializes a physical page (the con- tents of the page are zeroed out) and loads the address into the page table. Number of pages that have been faulted while on the inactive list. Number of requests for pages from a pager. Number of pages that have been paged out. Number of task and thread context switches. Number of nonclock device interrupts. Number of system calls called. Appends iowait information to the default output as follows:. Vir- tual Memory Statistics: (pagesize = 8192) procs memory pages intr cpu r w u act free wire fault cow pin pout in sy cs us sy id iowait 2 82 29 23K 12K 4905 3M 963K 710K 0 73 30 391 0 2 98 0 DESCRIPTION
The value of interval is a time in seconds, causing vmstat to display statistics at the specified interval. The first report generated includes statistics for the time since the last reboot. Each subsequent report is for the specified interval only. If you specify count after interval, it specifies the number of reports generated. For example, vmstat 1 10 produces 10 reports at 1-second intervals. You cannot specify count without interval, since the first numeric argument to vmstat is always assumed to be interval. At any time, system memory can be in use by the kernel in kseg, wired (pages that are currently in use and cannot be used for paging), on the active list (pages that are currently in use but can be used for paging), on the inactive list (pages that are allocated but are most likely to be used for paging), on the free list (pages that are clean and available for use), or used by the Unified Buffer Cache (UBC). The vmstat command does not report on the memory in kseg and memory used by the UBC. The following values are displayed: Process information: Number of threads that are running or are runnable. Number of threads waiting interruptibly. Number of threads wait- ing uninterruptibly. Virtual memory information: Total number of pages on the active list, the inactive list (pages that are allocated but are most likely to be used for paging), and the Unified Buffer Cache (UBC) least recently used (LRU) list. Total number of pages that are clean and available for use. Total number of pages that are currently in use and cannot be used for paging (not a real list). Number of address translation faults that have occurred. Number of copy-on-write page faults, which occur if the requested page is shared by a parent process and one or more child processes (using the fork function) and if one of the processes needs to modify the page. In this case, VM loads a new address into the translation buffer and copies the contents of the requested page into the new address for modification by the process. Number of zero-filled-on-demand page faults, which occur if VM cannot find the page in the internal data structures and if the requested page is new and has never been referenced. In this case, VM initializes a physical page (the contents of the page are zeroed out) and loads the address into the page table. Number of pages that have been faulted while on the inactive list. Number of requests for pages from a pager. Number of pages that have been paged out. Interrupt information: Number of nonclock device interrupts per second. Number of system calls called per second. Number of task and thread context switches per second. CPU information: Percentage of user time for normal and priority processes. Percentage of system time. Percentage of idle time. Percent- age of iowait. If the -w option is not specified, the iowait time is included in the id statistic. Specify -f to display fork statistics only. Specify -s for a single display of accumulated statistics, as well as page size. SEE ALSO
Commands: iostat(1), sysman(8) vmstat(1)
All times are GMT -4. The time now is 02:31 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy