Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8555341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T15:06:07+00:00 2026-06-11T15:06:07+00:00

I need some help with text manipulation. I do have data like this: 29554

  • 0

I need some help with text manipulation.
I do have data like this:

29554 31109 “ENSG00000243485.1” 1555
29554 31097 “ENSG00000243485.1” 1543
29554 30039 “ENSG00000243485.1” 485
30564 30667 “ENSG00000243485.1” 103
30267 30667 “ENSG00000243485.1” 400
30976 31109 “ENSG00000243485.1” 133
89295 133566 “ENSG00000238009.2” 44271
89295 120932 “ENSG00000238009.2” 31637
120775 120932 “ENSG00000238009.2” 157
112700 112804 “ENSG00000238009.2” 104
92091 92240 “ENSG00000238009.2” 149
28269867 28269929 “ENSG00000248451.1” 62
28270383 28270486 “ENSG00000248451.1” 103
28273195 28273372 “ENSG00000248451.1” 177
28275308 28275354 “ENSG00000248451.1” 46
…………………

I have to print the line with the biggest value per group.
There is group name in column 4 and values are in column 5.
As I imagine it should go like this:
1. Separating groups from each other;
2. Selecting biggest value;
3. Printing the whole line.

Preferred output for the example should be:

29554 31109 “ENSG00000243485.1” 1555
89295 133566 “ENSG00000238009.2” 44271
28273195 28273372 “ENSG00000248451.1” 177

Hope someone could help me with this in awk or sed.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T15:06:08+00:00Added an answer on June 11, 2026 at 3:06 pm

    This should do in bash and awk:

    GROUPS=$(cut -d' ' -f3 datafile | uniq) # list of groups
    for f in "$GROUPS"
    do 
      # print line if 4th field is max
      awk -v "grp=$f" '$0 ~ grp && $4 > max {max=$4; line=$0} END {print line}' datafile
    done
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help. I have many rows in my text file with this
Need some help to solve this. I have a gridview and inside the gridview
I need some help reading data from a text file into my ArrayList .
I need some help with this one.... I have this simple model: public class
I need some help. Don't know if this is possible. I want to have
I have some text with images inside it. For example like this texttext<img src=2011-08-15/4/img/123.JPG
I need some help with aligning the text. I want to achieve this https://i.stack.imgur.com/3aKvl.jpg
I need some help. Basically, I have a paragraph of text in a text
Need some help finishing up this program, everything works and runs like I want
I need some help with a MySQL query I'm working on. I have data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.