github twitter linkedin instagram - Shell script edition!
Jan 4, 2014
One minute read

I found that I often look words up on In my opinion, this is a process which could be greatly optimized.

So now I have this handy script for fetching word searches right from the comfort of my own terminal:

curl -s "$@" | perl -pe '
        s/<span[^>]*>([\w\s]*)<\/span>\s*<span[^>]*>([\w\s\p{P}]*)<\/span>/\n\e[36m\1:\t\e[0m \2\n/g;
        s/^\s+$//g; # Remove blank lines
' | perl -pe '
        # Remove all other junk.

Example use: <search term> test

I just put this puppy in my ~/bin directory which is included in my execution path. No more worrying about going to the web browser for word lookups from my favorite dictionary! :)

Back to posts