In response to this thread on FriendFeed…
curl -s 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=19614587&retmode=text&rettype=medline'|egrep '^(MH |DP )'
This will pull all the MeSH keywords and the date of publication from the article with PubMed ID 19614587. Stripping the field codes from the response is left as an exercise to the reader (but can be done trivially with a Unix command line utility).
Or for multiple documents, just use comma-separated IDs:
curl -s 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi?db=pubmed&id=11877539,11822933,11871444&retmode=text&rettype=medline'|egrep '^(PMID-|MH |DP )'
In this case it’s good to include the PubMed ID in the results so you know which values come from which doc.
There’s a full list of the MEDLINE field codes here, and the docs for efetch are here.
If you want to actually search by content, try esearch, which will return a list of IDs you can send to efetch.
For simple queries like this, XML is totally overkill.
Post a Comment