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

  • Home
  • SEARCH
  • 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 1082955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:22:13+00:00 2026-05-16T22:22:13+00:00

I’m trying to combine two lists, joining them by a common field suchs as

  • 0

I’m trying to combine two lists, joining them by a common field suchs as ENST00000371026. I’ve tried the following but no luck. What is the actual way to do it?

cat> gar1.txt <<EOF
ENST00000371026 ENSG00000152763
ENST00000371023 ENSG00000152763
ENST00000395250 ENSG00000152763
ENST00000309502 ENSG00000163485
ENST00000377464 ENSG00000142599
ENST00000400908 ENSG00000142599
ENST00000337907 ENSG00000142599
ENST00000400907 ENSG00000142599
ENST00000401087 ENSG00000179571
EOF

cat> gar2.txt <<EOF
DDX11L1 ENST00000371026
DDX11L9 ENST00000309502
DDX11L1 ENST00000371026
OR4F5   ENST00000377464
DQ597235        n/a
DQ599768        n/a
LOC388312       ENST00000401087
LOC100132287    ENST00000425496
LOC100132287    ENST00000425496
EOF

join -t"\t" -2 2 -1 1 gar1.txt gar2.txt

An example output would be:

DDX11L1 ENSG00000152763
DDX11L9 ENSG00000163485
OR4F5   ENSG00000142599
LOC388312       ENSG00000179571
LOC100132287    NONE
  • 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-05-16T22:22:13+00:00Added an answer on May 16, 2026 at 10:22 pm

    Give this a try:

    join -a 2 -t $'\t' -2 2 -1 1 -o 2.1 1.2 <(sort gar1.txt) <(sort -k 2,2 gar2.txt) | sed '/\t$/ s/$/NONE/' | uniq
    

    It uses Bash process substitution (<()), but you could simply presort your files if you don’t want to use that. Your version of join needs to have the -o option or you could use awk to process the output further. For the “n/a” lines it will print “NONE”, but you could do this to eliminate them:

    <(sort -k 2,2 gar2.txt | grep -v 'n/a$')
    

    Edit:

    This is the output I get without the sed and uniq:

    DDX11L9 ENSG00000163485
    DDX11L1 ENSG00000152763
    DDX11L1 ENSG00000152763
    OR4F5   ENSG00000142599
    LOC388312       ENSG00000179571
    LOC100132287
    LOC100132287
    DQ597235
    DQ599768
    

    And this is what I get with them:

    DDX11L9 ENSG00000163485
    DDX11L1 ENSG00000152763
    OR4F5   ENSG00000142599
    LOC388312       ENSG00000179571
    LOC100132287    NONE
    DQ597235        NONE
    DQ599768        NONE
    

    Adding the grep:

    DDX11L9 ENSG00000163485
    DDX11L1 ENSG00000152763
    OR4F5   ENSG00000142599
    LOC388312       ENSG00000179571
    LOC100132287    NONE
    

    which matches your example output except for the order. If you need to preserve the order it would be possible to do.

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

Sidebar

Related Questions

I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have just tried to save a simple *.rtf file with some websites and
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Does anyone know how can I replace this 2 symbol below from the string
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what 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.