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

The Archive Base Latest Questions

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

I want to do some simple database operations on a table without bothering with

  • 0

I want to do some simple database operations on a table without bothering with a database software, e.g., I can use the “filo” package from GitHub to do something similar to “groupby” function. I wonder is there something similar to achieve some simple “join” function? Or can I do it with Python or Bash? Specifically, I have a table like:

Col5a2  NM_007737   chr1    -   45447828    45447829
Slc40a1 NM_016917   chr1    -   45870140    45870141
Gm3852  NM_001177356    chr1    -   45956809    45956810
Slc39a10    NM_172653   chr1    -   46798055    46798056
Obfc2a  NM_028696   chr1    -   51422944    51422945
Myo1b   NM_001161817,NM_010863  chr1    -   51860519    51860520
.
.
.

And I have a list

Slc40a1
Myo1b
Col5a2
Obfc2a
.
.
.

I want to fetch the items in the list from the table, so that I will get:

Slc39a10    NM_172653   chr1    -   46798055    46798056
Myo1b   NM_001161817,NM_010863  chr1    -   51860519    51860520
Col5a2  NM_007737   chr1    -   45447828    45447829
Obfc2a  NM_028696   chr1    -   51422944    51422945
.
.
.
  • 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-15T08:40:31+00:00Added an answer on June 15, 2026 at 8:40 am

    Here’s one way using awk:

    awk 'FNR==NR { a[$1]=$0; next } $1 in a { print a[$1] }' table list
    

    or with formatting:

    awk 'FNR==NR { a[$1]=$0; next } $1 in a { print a[$1] }' table list | column -t
    

    Results:

    Slc40a1  NM_016917               chr1  -  45870140  45870141
    Myo1b    NM_001161817,NM_010863  chr1  -  51860519  51860520
    Col5a2   NM_007737               chr1  -  45447828  45447829
    Obfc2a   NM_028696               chr1  -  51422944  51422945
    

    Explanation:

    ‘FNR==NR { … }’ is a conditional that is only true for the first file in the argument list.

    So for each line in the file called ‘table’, the first column ($1) is added to an array (called ‘a’) and this is assigned the value of the whole line ($0). ‘next’ then skips to remainder of the code and jumps to the next line of input, until all lines in the ‘table’ file have been processed.

    ‘$1 in a’ is another conditional.

    This is asking if column one of the ‘list’ file is a key in the array. If it is, then print out the value of column one that we just stored in the array (a[$1]).

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

Sidebar

Related Questions

I wanted to make some simple file recovery software, where I want to try
I want to post some values from a simple HTML form, validate them with
I want to create some simple navigation in sencha touch 2. I have questions
I want to show some bold and some simple word within the same sentence.If
For some simple Windows batch script, I want to temporarily create a copy of
We want to do some fairly simple analysis of user's C++ code and then
so my problem is simple. I want to Encrypt some text and write it
I need to complete a very simple application. We want to archive some Sharepoint
I want to implement a simple script to do some boring housekeeping on my
I want to mail a simple HTML file containing some data. I want the

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.