Selecting lowest and highest values in columns 1 and 2, based on subsets in column 3
Hi,
I have a file with the following columns:
Essentially, using CHL1 as an example. For any line that has CHL1 in column 3, I want to select the lowest value in column 1 , and the highest value in column 2. These should then produce a single line that looks like
Using the same principle, for AGA, the line should look like
The whole file contains a about 500 unique names in column 3. CHL1 and AGA would be 2/500. Some sort of loop to run through each of these names would be perfect. I'm very new to Linux and have a bit of knowledge in very basic use of AWK, sed, grep ect but I'm unsure how to maniplulate the file to get the output as stated above.
Hi, many thanks for your reply! That prints the max value in column 2 for the specific name in column 3, but not the minimum value in column 1. I'll have a play and see if I can get that to work. One solution that was provided elsewhere was, which works perfectly is:
Hello, everyone
I am beginner for shell programming. I want to print all lines that have the same values in first two columns
data:
a b 1 2
a a 3 4
b b 5 6
a b 4 6
what I expected is :
a a 3 4
b b 5 6
but I searched for one hour in... (2 Replies)
Hi Guys,
I am looking for a way to sort the output below from the "Inuse" count from Highest to Lowest. Is it possible?
Thanks in advance.
user1 0.12 0.06 0 0.12
User Inuse Pin Pgsp Virtual
Unit:... (4 Replies)
cat sample.csv
ID,Name,no
1,AAA,1
2,BBB,1
3,AAA,1
4,BBB,1
cut -d',' -f2 sample.csv | sort | uniq
this gives only the 2nd column values
Name
AAA
BBB
How to I get all the columns of CSV along with this? (1 Reply)
Hi again!
I am still impressed how fast I get a solution for my topic "average specific column value awk" yesterday.
The associative arrays in awk work fine for me!
But now I have another question for the same project.
Now I have a list like this
1 -0.1
1 0
1 0.1
2 0
2 0.2
2 -0.2
How... (10 Replies)
Hello to all.
This is first post. Kindly excuse me if I do not adhere to any rules and regulations of this forum.
I have a file containing some rows with three columns each per row(separeted by a space). There are certain rows for which first two columns have same value but the value in... (6 Replies)
Hi, I want to extract the the top 10 and lowest 10 percentile for a column of values.
For example in column 2 for this file:
JOE 1
JAY 5
JAM 6
JIL 8
JIB 4
JIH 3
JIG 2
JIT 7
JAM 9
MAR 10
The top 10 lowest will be:
JOE 1
and the top 10 highest will be: (2 Replies)
Hy again guys,
Last week i resolve a question here but now i need your help again :rolleyes:
I have about 3000 files that i need to choose based on the lowest value, so i make temp files like this:
The files can have lines from 1-10 but only 2 columns, the point is to grep the name os the... (2 Replies)
Hi Guys !
i want to search a record in file by matching two values in a record in two different columns
suppose i have 3 columns
and i want to select all those values from col1 for which in col3 has a specific value
e.g select all "john" from column1 where column 3 has a value of "20"
... (9 Replies)
Hi
My pipe delimited .txt file contains rows with 10 columns.
Can anyone advise how I output to file only those rows with the letters ‘ci'
as the first 2 characters in the 3rd column ?
Many thanks (4 Replies)