This is the second part of my original problem.
File_1 is polled every second, the $2 is changing all the time:
0 0.00 1 0.00 2 0.00 3 0.00 4 0.00 5 0.00 6 0.00 7 0.00 8 -40.00 9 -20.00 10 -10.00 11 10.00 12 30.00 13 20.00 14 10.00 15 20.00 16 10.00 17 -10.00 18 -10.00 19 -10.00 20 -10.00 21 -10.00 22 10.00 23 0.00
File_2 is where I want to store min ($1) and max ($2) values and update them. The original File_2 is empty:
0 0.0000 0.0000 1 0.0000 0.0000 2 0.0000 0.0000 3 0.0000 0.0000 4 0.0000 0.0000 5 0.0000 0.0000 6 0.0000 0.0000 7 0.0000 0.0000 8 0.0000 0.0000 9 0.0000 0.0000 10 0.0000 0.0000 11 0.0000 0.0000 12 0.0000 0.0000 13 0.0000 0.0000 14 0.0000 0.0000 15 0.0000 0.0000 16 0.0000 0.0000 17 0.0000 0.0000 18 0.0000 0.0000 19 0.0000 0.0000 20 0.0000 0.0000 21 0.0000 0.0000 22 0.0000 0.0000 23 0.0000 0.0000
I want to store the absolute min and max values in File_2 and update them if a newly polled File_1 $1 contains higher/lower values. That means File_1 $1 has to be checked with File_2 $1 and $2 and if File_1 $1 is lower than File_2 $1 or higher than File_2 $2, then File_2 $1 or File_2 $2 has to be updated. All files are sorted.
Explanation:
This is going to be a radio frequency noise analyzer. Every line is a subchannel, where the rise or drop of the ingress RF noise is measured and read every second (stored in File_1). The goal is to get the absolute minimum and maximum values (or with other words the noise variation) during the measurement for every subchannel (every line) and store it in File_2 for further study.
Thanks in advance for your help!
I got it using
pasteandAWKcombination. This is the line:You can redirect the output wherever you want to save it. See explanation below.
Here is the output:
Explanation:
First of all, using
pasteI get “both files in one”, then I just check for min and max values (if statements inAWKcode) and I print the final result for each line.PS: Try
paste File_1 File_2if you do not know how it works.