Sponsored Content
Top Forums Shell Programming and Scripting Filtering my major and minor values Post 302751327 by vgersh99 on Thursday 3rd of January 2013 05:14:14 PM
Old 01-03-2013
it's a bit verbose, but can be used as a start.
awk -f newbie.awk myInputFile
newbie.awk:
Code:
function initVars()
{
  split("",n)
  split("",a)
  c=0
}

{
  for(i=2;i<=NF;i++)
    if ($i != "N") {
     if (!($i in a))
       n[++c]=$i
     a[$i]++
    }

  if (c>2) { initVars(); print;next }

  div=a[n[1]]/a[n[2]]
  div=(div>1)?1/div:div
  if ( div*100 > 30)
     print
  initVars()
}

 

9 More Discussions You Might Find Interesting

1. Programming

Device Major/Minor numbers

To further my fledgling knowledge of C, I am re-writing some of the Unix command set. My current command is an ls-style command. All works well, except for device files. How do I get the major/minor numbers for the dev files? I see from the stat struct there are st_rdev and st_dev members. Do... (1 Reply)
Discussion started by: zazzybob
1 Replies

2. Solaris

major & minor number

Hi Can anyone tell me what is major number and minor number in the mknod command. Also what these numbers mean. I have gone through the man pages but still I couldn't understand. Regards (3 Replies)
Discussion started by: RajaRC
3 Replies

3. Shell Programming and Scripting

sort major.minor.release_build_x

would like to order this input based on major.minor.release AND build number Label abc_def_0.0.3_build_999 2008/08/01 'Created by me.' Label abc_def_0.0.9_build_1000 2008/08/01 'Created by me.' Label abc_def_9.0.9_build_10001 2008/08/01 'Created by me.' Label abc_def_10.9.100_build_2... (4 Replies)
Discussion started by: gurpal2000
4 Replies

4. Solaris

Help with Major and minor number

Hi Does anyone know what the major and minor numbers are in Solaris? (2 Replies)
Discussion started by: wisdom
2 Replies

5. AIX

how do I change major-minor numbers of disk devices

Good evening ... does anyone of you know how to change major/minor numbers of disk devices ? I had to migrate from raid1 to raid5 and this messed up my ASM cluster - I know which devices should have which IDs to match the content - but I have no idea how to change it. Any help would be... (2 Replies)
Discussion started by: zxmaus
2 Replies

6. AIX

Difference between Major and Minor in AIX

Difference between Major and Minor in AIX (5 Replies)
Discussion started by: AIXlearner
5 Replies

7. Programming

which head file for major and minor function?

#include <sys/types.h> #include <sys/stat.h> #include <sys/termios.h> #include <stdio.h> #include <stdlib.h> #include <stddef.h> #include <string.h> #include <unistd.h> #include <signal.h> #include <sys/mkdev.h> int main(int argc, char *argv) { int i; struct stat buf; ... (4 Replies)
Discussion started by: konvalo
4 Replies

8. Shell Programming and Scripting

How to filter out major and minor?

Hi, I have line like this : proj_name/module/trunk/module_1_0 where the first "1" refers to major version and second "0" refers to minor version. any AWK or command like that so that I can filter out the major and minor ? like major= command | input line minor= command |... (4 Replies)
Discussion started by: bhaskar_m
4 Replies

9. Solaris

Major and Minor number of Virtual File System

Hi friends, Please let me know if there is any way to find out Major and Minor numbers of virtual file system like below: /devices 0K 0K 0K 0% /devices ctfs 0K 0K 0K 0% /system/contract proc 0K 0K ... (8 Replies)
Discussion started by: nitj
8 Replies
abs(3)							     Library Functions Manual							    abs(3)

delim $$

NAME
abs, div, labs, ldiv - Computes absolute value and division of integers LIBRARY
Standard C Library (libc.a) SYNOPSIS
#include <stdlib.h> int abs ( int i ); long labs ( long i ); div_t div ( int numerator , int denominator); ldiv_t ldiv ( long numerator, long denominator); PARAMETERS
For abs(), specifies some integer. For labs(), specifies some long integer. For div(), specifies some integer. For ldiv(), specifies some long integer. For div(), specifies some integer. For ldiv(), specifies some long integer. DESCRIPTION
The abs() function returns the absolute value of its integer operand. The div() function computes the quotient and remainder of the division of the numerator numerator by the denominator denominator. If the division is inexact, the sign of the resulting quotient is that of the algebraic quotient, and the magnitude of the resulting quotient is the largest integer less than the magnitude of the algebraic quotient. If the result cannot be represented (for example, if the denominator is 0), the behavior is undefined. The div() function returns a value of type div_t, comprising both the quotient and the remainder. The labs() and ldiv() functions perform the same functions as abs() and div() respectively, but accept long integers rather than integers as parameters. The ldiv() function returns a value of type ldiv_t, comprising both the quotient and the remainder. NOTES
The abs(), labs(), div(), and ldiv() functions are supported for multithreaded applications. A two's-complement integer can hold a negative number whose absolute value is too large for the integer to hold. When given this largest negative value, the abs() function returns the same value. Full use RETURN VALUES
The abs() function and labs() function return the absolute value of their arguments. The div() function returns a value of type div_t and the ldiv() function returns a value of type ldiv_t. RELATED INFORMATION
Functions: floor(3) delim off delim off abs(3)
All times are GMT -4. The time now is 09:19 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy