Skip to content

How to pull fields from MEDLINE the easy way

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.

Share/save this page:
  • email
  • Google Bookmarks
  • Twitter
  • FriendFeed
  • del.icio.us
  • Digg
  • Reddit
  • StumbleUpon
  • Technorati
  • DZone
  • Slashdot
  • Fark
  • Facebook
  • MySpace
  • LinkedIn
  • Live
  • connotea

Post a Comment

Your email is never published nor shared. Required fields are marked *