How can I Extract PMID only for a query in a text file while searching it on NCBI pubmed?
2
0
Entering edit mode
5.7 years ago

Hello all.

I have search "mycobacterium avium complex" at NCBI pubmed and I got 5963 results. I just want to extract only the PMID of all these 5963 papers in a file, can be a text file.

Is it is possible or not, if possible please help me in doing the same.

Thanks.

sequence literature extraction alignment next-gen • 1.4k views
ADD COMMENT
2
Entering edit mode
5.7 years ago
GenoMax 147k

You can use Entrezdirect to do this:

$ esearch -db pubmed -query "mycobacterium avium complex" | efetch -db pubmed -format native | grep PMID > PMID_file

will get you

PMID: 27401987  [Indexed for MEDLINE]
PMID: 27393550  [Indexed for MEDLINE]
PMID: 27389727  [Indexed for MEDLINE]
PMID: 27383726  [Indexed for MEDLINE]
PMID: 27383107  [Indexed for MEDLINE]
PMID: 27380997  [Indexed for MEDLINE]
PMID: 27375559
PMID: 27373718  [Indexed for MEDLINE]
PMID: 27368989  [Indexed for MEDLINE]
PMID: 27350276  [Indexed for MEDLINE]
PMID: 27339212
PMID: 27336739
PMID: 27335625
PMID: 27335623
PMID: 27332519  [Indexed for MEDLINE]

If you only need the actual numbers you can do the following:

$ esearch -db pubmed -query "mycobacterium avium complex" | efetch -db pubmed -format native | grep PMID | awk -F " " '{print $2}' > PMID_numbers

I currently see 6201 papers.

ADD COMMENT
0
Entering edit mode

thanks for helping me.

but I'm getting this error "WebEnv value not found in fetch input"

ADD REPLY
0
Entering edit mode
5.2 years ago
mrpfd3v • 0

enter image description hereIf you save the result set as a file PMID list is an option (see image).

Screenshot of file save options

ADD COMMENT

Login before adding your answer.

Traffic: 1754 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6