03-02-2009
Solution
This seems to do the trick!
HTML Code:
#!/bin/sh
#This file calculate the local maximum values in the second column
#of a file consisting of two columns and creates a file of this data.
#
#$1 represents the first input variable: the input file
#$2 represents the second input variable: the output file
input_file=$1
output_file=$2
i=0
j=0
while read line
do
i=`expr $i + 1`
eig[$i]=`echo $line|awk '{print $1}'` #eig and strain are arrays from 1 to length of file
strain[$i]=`echo $line|awk '{print $2}'`
done < $input_file
eig[$i+1]=0
strain[$i+1]=0
while [ $j -lt $i ]; do
j=`expr $j + 1`
if [ j == 1 ]; then
if [ ${strain[$j]} -gt ${strain[$j+1]} ]; then
echo ${eig[$j]} , ${strain[$j]} >> $output_file
fi
else
if [ ${strain[$j]} -gt ${strain[$j+1]} ] && [ ${strain[$j]} -gt ${strain[$j-1]} ]; then
echo ${eig[$j]} , ${strain[$j]} >> $output_file
fi
fi
done
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
HI all
I'm trying to write an awk script to print the min and max value in a range(s) contained in another file - the range values are in $2
EG
114,7964,1,y,y,n
114,7965,1,y,y,n
114,7966,1,y,y,n
114,7967,1,y,y,n
114,7969,1,y,y,n
114,7970,1,y,y,n
114,7971,1,y,y,n
114,7972,1,y,y,n... (3 Replies)
Discussion started by: Mudshark
3 Replies
2. Shell Programming and Scripting
Hello every one, I have following data
***CAMPAIGN 1998 CONTRIBUTIONS***
---------------------------------------------------------------------------
NAME PHONE Jan | Feb | Mar | Total Donated
... (12 Replies)
Discussion started by: devmiral
12 Replies
3. UNIX for Dummies Questions & Answers
hi, i have an awk script and I managed to figure out how to search the max value but Im having difficulty in searching for the min field value.
BEGIN {FS=","; max=0}
NF == 7 {if (max < $6) max = $6;}
END { print man, min}
where $6 is the column of a field separated by a comma (3 Replies)
Discussion started by: Kirichiko
3 Replies
4. Shell Programming and Scripting
Hi guys!
I'm new to scripting and I need to write a script in awk.
Here is example of file on which I'm working
ATOM 4688 HG1 PRO A 322 18.080 59.680 137.020 1.00 0.00
ATOM 4689 HG2 PRO A 322 18.850 61.220 137.010 1.00 0.00
ATOM 4690 CD ... (18 Replies)
Discussion started by: grincz
18 Replies
5. UNIX for Dummies Questions & Answers
Hi guys,
I already search on the forum but i can't solve this on my own.
I have a lot of files like this:
And i need to print the line with the maximum value in last column but if the value is the same (2 in this exemple for the 3 last lines) i need get the line with the minimum value in... (4 Replies)
Discussion started by: MetaBolic0
4 Replies
6. Programming
I feel stupid for asking this because it seems that MYSQL code isn't working the way that I think it should work.
Basically I wrote code like this:
select * from `Test_DC_Trailer` HAVING max(DR_RefKey);
Where the DR_RefKey is a unique numeric field that is auto iterated (like a primary key)... (7 Replies)
Discussion started by: Astrocloud
7 Replies
7. Shell Programming and Scripting
Hi,
I have sar disk reports like below sample:
01:01:00 hdisk24 0 0.0 0 0 0.0 0.0
hdisk15 0 0.0 0 3 0.0 5.5
hdisk20 0 0.0 2 1 0.0 1.9
hdisk19 1 ... (3 Replies)
Discussion started by: reddyr
3 Replies
8. Shell Programming and Scripting
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
9. Shell Programming and Scripting
Hi,
I have two files with values in both.
File1:
cat 2 3
dog 4 5
elephant 6 7
camel 2 3
File2:
----+--gkf;ajf=
---+----
+----- cat -------=----+ 3 | 4 ----- dog ------++-- 5 | 9 ----++-- elephant |
5 | 7
---++ camel ------ ++++_---- || 8 | 9
I want the final file as:
cat 4... (1 Reply)
Discussion started by: npatwardhan
1 Replies
WMND(1) General Commands Manual WMND(1)
NAME
wmnd - WindowMaker network device monitor
SYNOPSIS
wmnd [ -v | -h | [ -d display ] [ -i interface ] [ -w ] [ -b ] ]
DESCRIPTION
wmnd(1) is a WindowMaker dock application that shows a graph of the network traffic of the past few minutes, current activity and current
and overall send and receive rates. Additionally it can launch any program in response to mouse clicks.
There are two modes for the max-meter (the one on top of the graph). Per default it shows the maximum value on the graph. The second mode
shows the maximum value of a historical record since wmnd was started. You may left click on max-meter to switch modes, right click on max-
meter to hide the max-meter.
OPTIONS
-i interface
Start showing the status of network interface interface.
-w Draw the graph in waveform mode (default is inverse waveform mode). Right clicks cycle through all available modes.
-b Scale the values of the maximum and current rate by factors of base 2 instead of the default 10-based scaling. (1K equals 1024 in
binary mode, but 1000 in decimal mode.)
-h Show summary of options.
-d display
Draw onto X11 display display.
-v Show version of wmnd.
USAGE
Active Interface
You can cycle in realtime through all available active interfaces by simply left-clicking on the interface name gadget on the upperleft
corner of wmnd.
The 'lo' interface is an exception, 'lo' ONLY works when invoked from the commandline (wmnd -i lo), lo was mainly built in for testing pur-
poses.
Device Name
By default, wmnd show device name in short term of four characters, for example, the ippp0 will be displayed as ipp0. You can toggle the
device name between short and long by right-click on it.
Graphic Mode
Left-click on the main graphic area to cycle the graphic mode.
Max Meter
Left-click to toggle the history max or screen max, default is screen max when wmnd is startup. Right-click to hide or display.
Byte/Packet Mode
Left-click on the letter gadgeted on the right-top corner can switch between the Byte or Packet counter mode. "B" for byte, "p" for packet.
User Script
Click on the bottom rate meter can invoke the user command defined in resource file .wmndrc.
Dragging WMND
Be sure to drag WMND on it's outer edges, it's a bit picky due to the large gfx pixmap it keeps. You can also use a keyboard and mouse
shortcut (perhaps ALT+left-click) in your window manager to drag it around.
FILES
~/.wmndrc User configuration.
The format of this file is:
# WMND configuration file
# middle line in wave mode color
md_color=#71e371
# RX/TX color (can be #xxxxxx, or color name from rgb.txt)
rx_color=#188a86
tx_color=#00fff2
# refresh between status polling (not graph scroll speed)
# numbering in nanoseconds
refresh=50000
# bar graph scroll speed (in seconds) this setting also affectsi
# the rate and max speed displays. the longer the delay, more
# inaccurate these are since the max and rate values are averaged
# across this interval
scroll=1
# buttons for user scripts
# bt1_action=su -c ethereal
# bt2_action=
# bt3_action=
SEE ALSO
X(3x), wmaker(1x).
AUTHOR
This manual page was written by Arthur Korn <arthur@korn.ch>.
Dec 8, 2000 WMND(1)