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
.
.
.
Here’s one way using
awk:or with formatting:
Results:
Explanation: