Sponsored Content
Top Forums Shell Programming and Scripting Finding Maximum value in a column Post 302439974 by frans on Sunday 25th of July 2010 11:20:00 AM
Old 07-25-2010
Works with the provided example (only if 3 first fields are fixed width)
Code:
$ cat infile
1111 2222 AAAA 0.3
3333 4444 BBBB 0.7
1111 2222 AAAA 0.9
1111 2222 AAAA 0.5
3333 4444 BBBB 0.4
$ sort -rn infile | uniq -w14
3333 4444 BBBB 0.7
1111 2222 AAAA 0.9

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Unix shell script for finding top ten files of maximum size

I need to write a Unix shell script which will list top 10 files in a directory tree on basis of size. i.e. first file should be the biggest in the whole directory and all its sub directories. Please suggest any ideas (10 Replies)
Discussion started by: abhilashnair
10 Replies

2. Shell Programming and Scripting

for each different entry in column 1 extract maximum values from column 2 in unix/awk

Hello, I have 2 columns (1st column has multiple entries but the corresponding values in the column 2 may be the same or different.) however I want to extract unique values for each entry in column 1 by assigning the max value from column 2 SDF4 -0.211654 SDF4 0.978068 ... (1 Reply)
Discussion started by: Diya123
1 Replies

3. Homework & Coursework Questions

Find the Maximum value and average of a column

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: I am trying to complete a script which will allow me to find: a) reads a value from the keyboard. (ask the... (4 Replies)
Discussion started by: dstewie
4 Replies

4. Shell Programming and Scripting

Maximum of a column

Hi, I have a file like this a 1 2 a 5 8 a 66 100 b 1 2 b 2 3 b 111 143 d 4 5 d 4 6 e 77 727 g 7 8 How can I extract the maximum of col3 respective to col1. I meant, the output will be a 100 b 143 d 6 (1 Reply)
Discussion started by: jacobs.smith
1 Replies

5. Shell Programming and Scripting

Finding minimum maximum and average

I am trying to find the minimum maximum and average from one file which has values Received message from https://www.demandmatrix.net/app/dm/xml] in milliseconds. Received message from https://www.demandmatrix.net/app/dm/xml] in milliseconds. Received message from... (5 Replies)
Discussion started by: aroragaurav.84
5 Replies

6. Answers to Frequently Asked Questions

Finding maximum occurrence value using awk

Hi everyone, I'm a new member at the forum I have a file like this: field 2 values are either 0 or negative. file test4: 100815 -20 118125 0 143616 0 154488 0 154488 0 154488 -6 196492 -5 196492 -9 196492 -7 27332 0 29397 0 I would like to print a... (1 Reply)
Discussion started by: meet77
1 Replies

7. UNIX for Dummies Questions & Answers

Finding maximum occurrence value using awk

Hi everyone, I'm a new member at the forum I mistakenly posted this elsewhere too. I have a file like this: field 2 values are either 0 or negative. file test4: 100815 -20 118125 0 143616 0 154488 0 154488 0 154488 -6 196492 -5 196492 -9 196492 -7 27332 0... (5 Replies)
Discussion started by: meet77
5 Replies

8. Shell Programming and Scripting

Finding the maximum timestamp in a folder

I've the files in a directory in the following format having date +%Y%m%d%H YR_MNTH_2013061205 YR_MNTH_2013060107 and i need the latest file i.e; YR_MNTH_2013061205 to be moved to another folder #!/bin/ksh # Ksh 88 Version for test_time in YR* do --- done How can i achieve that !... (2 Replies)
Discussion started by: smile689
2 Replies

9. Shell Programming and Scripting

Get maximum per column from CSV file, based on date column

Hello everyone, I am using ksh on Solaris 10 and I'm gathering data in a CSV file that looks like this: 20170628-23:25:01,1,0,0,1,1,1,1,55,55,1 20170628-23:30:01,1,0,0,1,1,1,1,56,56,1 20170628-23:35:00,1,0,0,1,1,2,1,57,57,2 20170628-23:40:00,1,0,0,1,1,1,1,58,58,2... (6 Replies)
Discussion started by: ejianu
6 Replies

10. Shell Programming and Scripting

awk to find maximum and minimum from column and store in other column

Need your support for below. Please help to get required output If column 5 is INV then only consider column1 and take out duplicates/identical rows/values from column1 and then put minimum value of column6 in column7 and put maximum value in column 8 and then need to do subtract values of... (7 Replies)
Discussion started by: as7951
7 Replies
ipaddrsel(1M)                                                                                                                        ipaddrsel(1M)

NAME
ipaddrsel - configure IPv6 default address selection SYNOPSIS
/usr/sbin/ipaddrsel /usr/sbin/ipaddrsel -f file /usr/sbin/ipaddrsel -d Use the ipaddrsel utility to configure the IPv6 default address selection policy table. The policy table is a longest-matching-prefix lookup table that is used for IPv6 source address selection and for destination address ordering when resolving names to AF_INET6 addresses. For a description of how the policy table is used for source address selection, see inet6(7P). For a description of how the pol- icy table is used for destination address ordering, see getaddrinfo(3SOCKET). The unmodified policy table is valid for all typical IPv6 deployments. Modify the table only if a circumstance exists for which the default behavior of the IPv6 source address selection or destination address ordering mechanism is unsatisfactory. See the section for examples of such circumstances. You should carefully consider your addressing strategy before you change the table from the provided default. When the ipaddrsel command is issued without any arguments, the address selection policy currently in use is printed. The format of the output is compatible with the format of the configuration file that the -f option accepts. Note - If the usesrc subcommand to ifconfig(1M) is applied to a particular physical interface, the selection policy specified by usesrc overrides the source address selection policies specified by ipaddrsel. This is true for packets that are locally generated and for applications that do not choose a non-zero source address using bind(3SOCKET). The Configuration File The configuration file that the -f option accepts can contain either comment lines or policy entries. Comment lines have a '#' character as the first non-blank character. and they are ignored by the ipaddrsel utility. Policy entry lines have the following format: prefix/prefix_length precedence label [# comment ] The prefix must be an IPv6 prefix in a format consistent with inet(3SOCKET). The prefix_length is an integer ranging from 0 to 128. The IPv6 source address selection and destination address ordering algorithms determine the precedence or label of an address by doing a long- est-prefix-match lookup using the prefixes in this table, much like next-hop determination for a destination is done by doing a longest- prefix-match lookup using an IP routing table. The precedence is a non-negative integer that represents how the destination address ordering mechanism will sort addresses returned from name lookups. In general, addresses with a higher precedence will be in front of addresses with a lower precedence. Other factors, such as destinations with undesirable source addresses can, however, override these precedence values. The label is a string of at most fifteen characters, not including the NULL terminator. The label allows particular source address prefixes to be used with destination prefixes of the same label. Specifically, for a particular destination address, the IPv6 source address selec- tion algorithm prefers source addresses whose label is equal that of the destination. The label may be followed by an optional comment. The file must contain a default policy entry, which is an entry with "::0/0" as its prefix and prefix_length. This is to ensure that all possible addresses match a policy. The ippadrsel utility supports the following options: -f file Replace the address selection policy table with the policy specified in the file. -d Revert the kernel's address selection policy table back to the default table. Invoking ipaddrsel in this way only changes the currently running kernel's policy table, and does not alter the configuration file /etc/inet/ipaddrsel.conf. To revert the configuration file back to its default settings, use ipaddrsel -d, then dump the contents of the table to the configu- ration file by redirecting the output of ipaddrsel to /etc/inet/ipaddrsel.conf. example# ipaddrsel -d example# ipaddrsel > /etc/inet/ipaddrsel.conf Example 1: The Default Policy in /etc/inet/ipaddrsel.conf The following example is the default policy that is located in /etc/inet/ipaddrsel.conf: # Prefix Precedence Label ::1/128 50 Loopback ::/0 40 Default 2002::/16 30 6to4 ::/96 20 IPv4_Compatible ::ffff:0.0.0.0/96 10 IPv4 Example 2: Assigning a Lower Precedence to Link-local and Site-local Addresses By default, the destination address ordering rules sort addresses of smaller scope before those of larger scope. For example, if a name resolves to a global and a site-local address, the site local address would be ordered before the global address. An administrator can override this ordering rule by assigning a lower precedence to addresses of smaller scope, as the following table demonstrates. # Prefix Precedence Label ::1/128 50 Loopback ::/0 40 Default 2002::/16 30 6to4 fec0::/10 27 Site-Local fe80::/10 23 Link-Local ::/96 20 IPv4_Compatible ::ffff:0.0.0.0/96 10 IPv4 Example 3: Assigning Higher Precedence to IPv4 Destinations By default, IPv6 addresses are ordered in front of IPv4 addresses in name lookups. ::ffff:0.0.0.0/96 has the lowest precedence in the default table. In the following example, IPv4 addresses are assigned higher precedence and are ordered in front of IPv6 destinations: # Prefix Precedence Label ::1/128 50 Loopback ::/0 40 Default 2002::/16 30 6to4 ::/96 20 IPv4_Compatible ::ffff:0.0.0.0/96 60 IPv4 Example 4: Ensuring that a particular source address is only used when communicating with destinations in a particular network. The following policy table assigns a label of 5 to a particular source address on the local system, 2001:1111:1111::1. The table assigns the same label to a network, 2001:2222:2222::/48. The result of this policy is that the 2001:1111:1111::1 source address will only be used when communicating with destinations contained in the 2001:2222:2222::/48 network. For this example, this network is the "ClientNet", which could represent a particular client's network. # Prefix Precedence Label ::1/128 50 Loopback 2001:1111:1111::1/128 40 ClientNet 2001:2222:2222::/48 40 ClientNet ::/0 40 Default 2002::/16 30 6to4 ::/96 20 IPv4_Compatible ::ffff:0.0.0.0/96 10 IPv4 This example assumes that the local system has one physical interface, and that all global prefixes are assigned to that physical inter- face. ipaddrsel returns the following exit values: 0 ipaddrsel successfully completed. >0 An error occurred. If a failure is encountered, the kernel's current policy table is unchanged. /etc/inet/ipaddrsel.conf The file that contains the IPv6 default address selection policy to be installed at boot time. This file is loaded before any Internet services are started. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |Evolving | +-----------------------------+-----------------------------+ nscd(1M), inet(3SOCKET), getaddrinfo(3SOCKET), ipaddrsel.conf(4), attributes(5), inet6(7P) The ipnodes cache kept by nscd(1M) contains addresses that are ordered using the destination address ordering algorithm, which is one of the reasons why ipaddrsel is called before nscd in the boot sequence. If ipaddrsel is used to change the address selection policy after nscd has started, you should invalidate the nscd ipnodes cache invalidated by invoking the following command: example# /usr/sbin/nscd -i ipnodes 16 Jul 2004 ipaddrsel(1M)
All times are GMT -4. The time now is 09:12 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy