Skip to content

Instantly share code, notes, and snippets.

@SahilC
Created December 9, 2014 13:44
Show Gist options
  • Save SahilC/ae4d562279764152775f to your computer and use it in GitHub Desktop.
Save SahilC/ae4d562279764152775f to your computer and use it in GitHub Desktop.
Use this script to find meanings of words from bash shell. For convenience, make this script executable and add alias to file with the command `alias define='path-to-define.sh-file'`
#!/bin/bash
wget -q -O - "http://www.macmillandictionary.com/dictionary/british/$1" | grep -P -o "<span class=\"DEFINITION\">(.*?)</span>" | grep -Po '(?<=href=")[^"]*' | grep -Po '=.*?$' | cut -d = -f 2 | awk '{printf "%s ",$1}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment