Sponsored Content
Top Forums Shell Programming and Scripting Help in finding the max and min position Post 302203356 by robotronic on Sunday 8th of June 2008 07:32:01 AM
Old 06-08-2008
Given the provided input file and your instructions, you could split your problem and try something simple, like this:

Code:
line=321

score=`awk -v "l=${line}" '$3 == l { print $2 }' input_file.txt`

awk -v "s=${score}" '
   $2 == s {
      n=$1;
      if (!min || (n<min)) min=n;
      if (!max || (n>max)) max=n;
   }
   END {
      print min, max;
   }
' input_file.txt

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

min and max value of process id

We are running a AIX 5.2 OS. Would anyone happen to know what the max value for a process id could be? Thanks jerardfjay :) (0 Replies)
Discussion started by: jerardfjay
0 Replies

2. Shell Programming and Scripting

get min, max and average value

hi! i have a file like the attachement. I'd like to get for each line the min, max and average values. (there is 255 values for each line) how can i get that ? i try this, is it right? BEGIN {FS = ","; OFS = ";";max=0;min=0;moy=0;total=0;freq=890} $0 !~ /Trace1:/ { ... (1 Reply)
Discussion started by: riderman
1 Replies

3. Shell Programming and Scripting

Data stream between min and max

Hi, I have a text file containing numbers. There are up to 6 numbers per row and I need to read them, check if they are 0 and if they are not zero check if they are within a given interval (min,max). If they exceed the max or min they should be set to max or min respectively, if they are in the... (4 Replies)
Discussion started by: f_o_555
4 Replies

4. Shell Programming and Scripting

to find min and max value for each column!

Hello Experts, I have got a txt files which has multiple columns, I want to get the max, min and diff (max-min) for each column in the same txt file. Example: cat file.txt a 1 4 b 2 5 c 3 6 I want ouput like: cat file.txt a 1 4 b 2 5 c 3 6 Max 3 6 Min 1 4 Diff 2 2 awk 'min=="" ||... (4 Replies)
Discussion started by: dixits
4 Replies

5. Homework & Coursework Questions

Perl max and min issues

I have to find the min and max on a specific column in a file after sending that column and one other to a output file but I keep getting a maximum of zero below is what i have so far if anyone can give me advice on what i am doing wrong the help would be much appreciated # ! /usr/bin/perl -w... (2 Replies)
Discussion started by: dstewie
2 Replies

6. Shell Programming and Scripting

Converting a date to friday date and finding Min/Max date

Dear all, I have 2 questions. I have a file with many rows which has date of the format YYYYMMDD. 1. I need to change the date to that weeks friday date(Ex: 20120716(monday) to 20120720). Satuday/Sunday has to be changed to next week friday date too. 2. After converting the date to... (10 Replies)
Discussion started by: 2001.arun
10 Replies

7. Shell Programming and Scripting

Print min and max value from two column

Dear All, I have data like this, input: 1254 10125 1254 10126 1254 10127 1254 10128 1254 10129 1255 10130 1255 10131 1255 10132 1255 10133 1256 10134 1256 10135 1256 10137... (3 Replies)
Discussion started by: aksin
3 Replies

8. Shell Programming and Scripting

Get the min avg and max with awk

aaa: 3 ms aaa: 2 ms aaa: 5 ms aaa: 10 ms .......... to get the 3 2 5 10 ...'s min avg and max something like min: 2 ms avg: 5 ms max: 10 ms (2 Replies)
Discussion started by: yanglei_fage
2 Replies

9. 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

10. Shell Programming and Scripting

Get min and max value in column

Gents, I have a big file file like this. 5100010002 5100010004 5100010006 5100010008 5100010010 5100010012 5102010002 5102010004 5102010006 5102010008 5102010010 5102010012 The file is sorted and I would like to find the min and max value, taking in the consideration key1... (3 Replies)
Discussion started by: jiam912
3 Replies
GO500(8C)																 GO500(8C)

NAME
go500 - Local Gopher index search to X.500 search gateway SYNOPSIS
/usr/sbin/go500 [-b searchbase] [-d level] [-l] [-x hostname] [-c rdncount] [-f filterfile] [-t templatefile] [-p port] [-I] DESCRIPTION
go500 is the local gopher index search to X.500 search daemon. It looks like a gopher index server to a gopher client, translating the search criteria it is given into a search of a pre-configured portion of the X.500 directory. It uses LDAP to talk to X.500. By default, it listens on port 5555 for connections from gopher clients. The go500 server can be run either from inetd(8) or as stand-alone server. STAND-ALONE OPERATION To start go500 as a stand-alone server, simply start it with no arguments /usr/sbin/go500 If you would like to start it at boot time add some lines like this to the etc/rc.local or equivalent file: if [ -f /usr/sbin/go500 ]; then /usr/sbin/go500; echo ' go500' fi OPERATION WITH INETD
To arrange to have go500 started from inetd(8), the Internet protocol daemon, add a line like the following to your /etc/services file, or the equivalent: go500 5555/tcp go500 Next, add a line like this to your /etc/inetd.conf file, or the equivalent: go500 stream tcp nowait nobody /usr/sbin/go500 go500 -I For these changes to take effect with inetd, you will probably have to send it it a HUP signal. See inetd(8) for more details. GOPHER CONFIGURATION
The next step is to configure your local gopher server to have an entry for go500. With the standard unix gopher server, this can be done with a .link file. A sample .link file is given below, with the things you should change given in <>'s: Name=<Label of your choice> Type=7 Port=5555 Path= Host=<host.running.go500.here> You may also have to restart your gopher daemon, or remove the .cache file. See gopherd(8) for more details. OPTIONS
-b searchbase Specify an alternate starting point for searches. The argument should be a Distinguished Name in the form defined by RFC 1485. For example, the DN "o=University of Michigan, c=US" could be given to search the University of Michigan portion of the X.500 tree. -d level Turn on debugging as defined by level. If this option is specified, go500 will not fork or disassociate from the invoking terminal. Some general operation and status messages are printed for any value of level. level is taken as a bit string, with each bit corre- sponding to a different kind of debugging information. -f filterfile Specify an alternate filter configuration file for use with the ldap_getfilter(3) facility, used by go500. -l Enable logging of various status and errors to the LOG_DAEMON facility via syslog(8). -p port Specify an alternate port on which to listen for connections. -t templatefile Specify an alternate template configuration file for use with the ldap_init_templates(3) facility, used by go500. -c rdncount Specify the number of DN components to show for the names and DN attributes within entries matching the search. -x hostname Specify an alternate host on which the ldap server is running. -I Run from inetd(8). NOTES
Some implementations of inetd have a small limit on the number of arguments that can be specified in the /etc/inetd.conf(5) file. This can cause problems if you are using go500 with a lot of arguments. The default values for most of the things you can specify with options are configured at compile time in the include/ldapconfig.h.edit include file. SEE ALSO
ldap(3), inetd(8), gopherd(8), go500gw(8) ACKNOWLEDGEMENTS
OpenLDAP is developed and maintained by The OpenLDAP Project (http://www.openldap.org/). OpenLDAP is derived from University of Michigan LDAP 3.3 Release. OpenLDAP 2.0.27-Release 20 August 2000 GO500(8C)
All times are GMT -4. The time now is 09:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy