How can I Extract PMID only for a query in a text file while searching it on NCBI pubmed?
2
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
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.
If you save the result set as a file PMID list is an option (see image).
Login before adding your answer.
Traffic: 2353 users visited in the last hour
thanks for helping me.
but I'm getting this error "WebEnv value not found in fetch input"