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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:03:23+00:00 2026-06-12T14:03:23+00:00

I have a (very) basic understanding of AWK, I have tried a few ways

  • 0

I have a (very) basic understanding of AWK, I have tried a few ways of doing this but all print out far more lines than I want:

I have 10 lines in file.1:

chr10   234567
chr20   123456
...
chrX    62312

I want to move to uppercase and match the first 2 columns of file.2, so first line below matches second line above, but I don’t want to get second line below which matches third line above for position but not chr, and I don’t want the first line below to match the first line above.

CHR20   123456    ...   234567 
CHR28   234567    ...   62312

I have:

$ cat file.1 | tr '[:lower:]' '[:upper:]' | <grep? awk?>

and would love to know how to proceed. I had used a simple grep – previously but the second column of file.1 matches more in the searched file so I get hundreds of lines returned. I want to just match on the first 2 columns (they correspond to the first 2 columns in the file.2).

Hope thats clear enough for you, look forward to your answers=)

  • 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-12T14:03:24+00:00Added an answer on June 12, 2026 at 2:03 pm

    If the files are sorted by the first column you can do:

    join -i file.1 file.2 ¦ awk '$3==$2{ $3=""; print}'
    

    If they’re not sorted, sort them first.

    The -i flag says to ignore case.

    That won’t work if there are multiple lines with the same field in the first column. To make that work you would need something more complicated

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a very basic understanding of shell scripting, but what I need to
I have some very basic semaphore code that works great on Linux, but cannot
I'm fairly new to iOS programming, but have a basic understanding of it. I
I have a decent understanding of C# and a very basic understanding of powershell.
I have a very basic understanding of how autoconf and automake work, gathered from
First off, I only have a very basic understanding of SQL. I can create
Sorry if this is a very basic question As for my understanding if you
I have a very basic LEFT OUTER JOIN to return all results from the
I have very basic understanding problem of Content types. I went through lot of
I have a very basic understanding of bitwise operators. I am at a loss

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.