I have a question control txt file.
One file contain 4 column and if I want to cut rows except maximum values in the columns
1.Check First Column Name
2.Check Last Column Values.
3.Remove depends on First Column and Last Column.
Test1 500 400 200
Test1 499 400 200
Test1 499 399 200
Test1 498 100 100
Test2 600 200 150
Test2 600 199 150
Test2 599 199 100
I want to delete line without top line of Name For example as below Name Score Length
Test1 500 400 200
Test1 499 400 200
Test1 499 399 200
Test2 600 200 150
Test2 600 199 150
Anyone have a good Idea to figure it out? Awk or Sed ..
Thank you for your any information!
ubuntu awk sed
1.,2.and3.in the file? Please reformat the question if not. - Barmarawk, save every line into an array. Simultaneously, make an associative array that contains the maximum value for each name. Then in theENDblock, loop through the saved line array, printing it if it matches the maximum value for the name. - Barmar