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 9242059
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:30:06+00:00 2026-06-18T08:30:06+00:00

I have text file which has tab-delimited columns in following format: fileName Type sc1

  • 0

I have text file which has tab-delimited columns in following format:

fileName    Type    sc1 sc2 sc3 sc4 sc5 sc6
file1   abc 0   0.2 0   0   0   0
file1   xyz 0   0.8 0   0   0.8 0.2
file2   abc 0.5 0   0   0.1 0   0
file2   xyz 0   0   0   0.7 0.003   0.1
file3   abc 0.002   0   0   0   0.04    0
file3   xyz 0.5 0   0   0   0   0.3
.
. 

First row is the header row.
sc1, sc2, sc3 etc are score 1, score 2, score 3 (they are not all zeros)

There are more than two types and each file has same number of types.

How to know the fileName which has lowest sc6 for xyz type?
or how to create another text file from this file, which will have filename and sc6 for all xyz type?

I really don’t want to load this as a db or do something like that. I was wondering if I can accomplish this rather quickly using Unix’s cut , sort or grep commands. Any perl, awk solution acceptable too.

Let me know if the question is not very clear.

P.S. Please feel free to suggest different heading for this question. This is the best I could come up with.

  • 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-18T08:30:07+00:00Added an answer on June 18, 2026 at 8:30 am
    awk -v lowest=9999999 '$2 == "xyz" && $8 < lowest { lowest = $8; lowfile = $1 }
                           END {print lowfile, "\t", lowest}' infile
    

    or:

    awk '$2 == "xyz"' infile | sort -k 8n | head -1 | cut -f1,8
    

    To create a file with just filename and sc6 for all xyz:

    awk '$2 = "xyz" {print $1, "\t", $8}' infile > outfile
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tab delim text file which contains the following columns: Probe A_sig A_Pval
Supposedly I have this line in my text file which has the following format.
I have a text file which has the following structure: 341|18 Hello world|20090225230048AAnhStI|90|$0.30|10|289|2|2|2|Is that
I have a text file which has the following data {i:1, j:2} {k:3, l:10}
I have a text file which has a particular line something like sometext sometext
I have this xml file which has text init. i.e Hi my name is
I have progress.js file which has the following code $('#text_area_input').keyup(function() { var text_area_box =$(this).val();//Get
i have a java ee project which has a text file that uses a
I'm having trouble with PHP text parsing I have a txt file which has
I am using itertools.groupby to parse a short tab-delimited textfile. the text file has

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.