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
iconv_1250(5)						Standards, Environments, and Macros					     iconv_1250(5)

NAME
iconv_1250 - code set conversion tables for MS 1250 (Windows Latin 2) DESCRIPTION
The following code set conversions are supported: +----------------------------------------------------------------------+ | Code Set Conversions Supported | +-------------+----------+--------------+----------+-------------------+ | Code | Symbol | Target Code | Symbol | Target Output | +-------------+----------+--------------+----------+-------------------+ |MS 1250 | win2 | ISO 8859-2 |iso2 |ISO Latin 2 | +-------------+----------+--------------+----------+-------------------+ |MS 1250 | win2 | MS 852 |dos2 |MS-DOS Latin 2 | +-------------+----------+--------------+----------+-------------------+ |MS 1250 | win2 | Mazovia |maz |Mazovia | +-------------+----------+--------------+----------+-------------------+ |MS 1250 | win2 | DHN |dhn |Dom Handlowy Nauki | +-------------+----------+--------------+----------+-------------------+ CONVERSIONS
The conversions are performed according to the following tables. All values in the tables are given in octal. MS 1250 to ISO 8859-2 For the conversion of MS 1250 to ISO 8859-2, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | MS 1250 | ISO 8859-2 | MS 1250 | ISO 8859-2 | |24-211 | 40 |235 |273 | |212 | 251 |236 |276 | |213 | 40 |237 |274 | |214 | 246 |241 |267 | |215 | 253 |245 |241 | |216 | 256 |246-267 |40 | |217 | 254 |271 |261 | |221-231 | 40 |273 |40 | |232 | 271 |274 |245 | |233 | 40 |276 |265 | |234 | 266 |247 |365 | +---------------+----------------+----------------+---------------+ MS 1250 to MS 852 For the conversion of MS 1250 to MS 852, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | MS 1250 | MS 852 | MS 1250 | MS 852 | |200-211 | 40 |311 |220 | |212 | 346 |312 |250 | |213 | 40 |313 |323 | |214 | 227 |314 |267 | |215 | 233 |315 |326 | |216 | 246 |316 |327 | |217 | 215 |317 |322 | |220-231 | 40 |320 |321 | |232 | 347 |321 |343 | |233 | 40 |322 |325 | |234 | 230 |323 |340 | |235 | 234 |324 |342 | |236 | 247 |325 |212 | |237 | 253 |326 |231 | |240 | 377 |327 |236 | |241 | 363 |330 |374 | |242 | 364 |331 |336 | |243 | 235 |332 |351 | |244 | 317 |333 |353 | |245 | 244 |334 |232 | |246 | 40 |335 |355 | |247 | 365 |336 |335 | |250 | 371 |337 |341 | |251 | 40 |340 |352 | |252 | 270 |341 |240 | |253 | 256 |342 |203 | |254 | 252 |343 |307 | |255 | 360 |344 |204 | |256 | 40 |345 |222 | |257 | 275 |346 |206 | |260 | 370 |347 |207 | |261 | 40 |350 |237 | |262 | 362 |351 |202 | |263 | 210 |352 |251 | |264 | 357 |353 |211 | |265-267 | 40 |354 |330 | |270 | 367 |355 |241 | |271 | 245 |356 |214 | |272 | 255 |357 |324 | |273 | 257 |360 |320 | |274 | 225 |361 |344 | |275 | 361 |362 |345 | |276 | 226 |363 |242 | |277 | 276 |364 |223 | |300 | 350 |365 |213 | |301 | 265 |366 |224 | |302 | 266 |367 |366 | |303 | 306 |370 |375 | |304 | 216 |371 |205 | |305 | 221 |372 |243 | |306 | 217 |374 |201 | |307 | 200 |375 |354 | |310 | 254 |376 |356 | +---------------+----------------+----------------+---------------+ MS 1250 to Mazovia For the conversion of MS 1250 to Mazovia, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | MS 1250 | Mazovia | MS 1250 | Mazovia | |200-213 | 40 |310-311 |40 | |214 | 230 |312 |220 | |215-216 | 40 |313-320 |40 | |217 | 240 |321 |245 | |220-233 | 40 |322 |40 | |234 | 236 |323 |243 | |235-236 | 40 |324-325 |40 | |237 | 246 |326 |231 | |240 | 377 |327-333 |40 | |241-242 | 40 |334 |232 | |243 | 234 |335-336 |40 | |244 | 40 |337 |341 | |245 | 217 |340-341 |40 | |246-252 | 40 |342 |203 | |253 | 256 |343 |40 | |254 | 252 |344 |204 | |255-256 | 40 |345 |40 | |257 | 241 |346 |215 | |260 | 370 |347 |207 | |261 | 361 |350 |40 | |262 | 40 |351 |202 | |263 | 222 |352 |221 | |264 | 40 |353 |211 | |265 | 346 |354-355 |40 | |266 | 40 |356 |214 | |267 | 372 |357-360 |40 | |270 | 40 |361 |244 | |271 | 206 |362 |40 | |272 | 40 |363 |242 | |273 | 257 |364 |223 | |274-276 | 40 |365 |40 | |277 | 247 |366 |224 | |300-303 | 40 |367 |366 | |304 | 216 |370-373 |40 | |305 | 40 |374 |201 | |306 | 225 |375-376 |40 | |307 | 200 | | | +---------------+----------------+----------------+---------------+ MS 1250 to DHN For the conversion of MS 1250 to DHN, all characters not in the following table are mapped unchanged. +-----------------------------------------------------------------+ | | Conversions|Performed | | | MS 1250 | DHN | MS 1250 | DHN | |200-213 | 40 |306 |201 | |214 | 206 |307-311 |40 | |215-216 | 40 |312 |202 | |217 | 207 |313-320 |40 | |220-233 | 40 |321 |204 | |234 | 217 |322 |40 | |235-236 | 40 |323 |205 | |237 | 220 |324-325 |40 | |240 | 377 |326 |231 | |241-242 | 40 |327-333 |40 | |243 | 203 |334 |232 | |244 | 40 |335-336 |40 | |245 | 200 |337 |341 | |246-252 | 40 |340 |40 | |253 | 256 |341 |240 | |254 | 252 |342-345 |40 | |255-256 | 40 |346 |212 | |257 | 210 |347-351 |40 | |260 | 370 |352 |213 | |261 | 361 |353-354 |40 | |262 | 40 |355 |241 | |263 | 214 |356-360 |40 | |264 | 40 |361 |215 | |265 | 346 |362 |40 | |266 | 40 |363 |216 | |267 | 372 |364 |223 | |270 | 40 |365 |40 | |271 | 211 |366 |224 | |272 | 40 |367 |366 | |273 | 257 |370-371 |40 | |274-276 | 40 |372 |243 | |277 | 221 |373-376 |40 | |300-305 | 40 | | | +---------------+----------------+----------------+---------------+ FILES
/usr/lib/iconv/*.so conversion modules /usr/lib/iconv/*.t conversion tables /usr/lib/iconv/iconv_data list of conversions supported by conversion tables SEE ALSO
iconv(1), iconv(3C), iconv(5) SunOS 5.10 18 Apr 1997 iconv_1250(5)
All times are GMT -4. The time now is 05:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy