Charlie Harvey

Lunchtime hack: Google spellchecker on the commandline onliner

I was just talking to my colleague Pete about how useful Google’s "Did you mean?" feature is as a spell checker. It comes up with much better suggestions than other systems. So here is a quick lunchtime hack that uses the little-known Lynx browser -dump command and some Perl to make a commandline spell check tool. Let’s say I forgot how to spell my own name. I could type the following and get a did you mean suggestion form Google $ q=charlieharvee;lynx -dump https://www.google.com/search?q=$q | grep -e 'the original' | perl -nE 's/.*\]([^\.]+)\..*/$1/;print' charlie harvey

Just change the q=charlieharvee to q=whateveryouwanttolookup and you’re away. Of course this would be a nice thing to make into a proper Bash script but I like the aesthetic of the oneliner!


Comments

  • Be respectful. You may want to read the comment guidelines before posting.
  • You can use Markdown syntax to format your comments. You can only use level 5 and 6 headings.
  • You can add class="your language" to code blocks to help highlight.js highlight them correctly.

Privacy note: This form will forward your IP address, user agent and referrer to the Akismet, StopForumSpam and Botscout spam filtering services. I don’t log these details. Those services will. I do log everything you type into the form. Full privacy statement.