Google Spell Checker

spellcheck(){ curl -sd "<spellrequest><text>$1</text></spellrequest>" | sed 's/.*<spellresult [^>]*>\(.*\)<\/spellresult>/\1/;s/<c \([^>]*\)>\([^<]*\)<\/c>/\1;\2\n/g' | grep 's="1"' | sed 's/^.*;\([^\t]*\).*$/\1/'; }
Sample Output

2010-02-17 01:55:28

1 Alternatives + Submit Alt

  • I took matthewbauer's cool one-liner and rewrote it as a shell function that returns all the suggestions or outputs "OK" if it doesn't find anything wrong. It should work on ksh, zsh, and bash. Users that don't have tee can leave that part off like this: spellcheck(){ typeset y=$@;curl -sd "<spellrequest><text>$y</text></spellrequest>"|sed -n '/s="[1-9]"/{s/<[^>]*>/ /g;s/\t/ /g;s/ *\(.*\)/Suggestions: \1\n/g;p}';} Show Sample Output

    spellcheck(){ typeset y=$@;curl -sd "<spellrequest><text>$y</text></spellrequest>"|sed -n '/s="[0-9]"/{s/<[^>]*>/ /g;s/\t/ /g;s/ *\(.*\)/Suggestions: \1\n/g;p}'|tee >(grep -Eq '.*'||echo -e "OK");}
    eightmillion · 2010-02-17 08:20:48 5

What Others Think

minor usability alteration: spelll() { gspell="$@"; curl -sd "<spellrequest><text>$gspell</text></spellrequest>" | sed 's/.*<spellresult [^>]*>\(.*\)<\/spellresult>/\1/;s/<c \([^>]*\)>\([^<]*\)<\/c>/\1;\2\n/g' | grep 's="1"' | sed 's/^.*;\([^\t]*\).*$/\1/'; } spelll obssesion obsession
oshazard · 586 weeks and 2 days ago
Dallas, a modern metropolis in north Texas, is a commercial and cultural hub of the region. Downtown’s Sixth Floor Museum at Dealey Plaza commemorates the site of President John F. Kennedy’s assassination in 1963. MaxRemind top rank medical billing company of USA offers medical billing services in Dallas, medical credentialing services and home health agency software in Dallas.
stevematt · 15 weeks and 4 days ago
Individuals who are worried about the Dehydration and Core Temp, are moved nearer to review this article. Click home for more info. By keeping open principles there, one can get comfortable with an incomprehensible game-plan about it.
Ahmed74 · 12 weeks and 6 days ago
I think I like this got base. Check this web portal for more info. The producer of this base has followed a novel method which is having all the stores of being absolutely reasonable.
Ahmed74 · 12 weeks and 6 days ago
Acquitting the way that I purchased the awe-inspiring assortment of Bitdefender, Visit homepage for more info. I was unable to get to all features of this instrument. With your help, I have found the method of this issue.
Ahmed74 · 12 weeks and 6 days ago
Key focal concentrations and highlights have been equipped with the Citi Mastercard considering which it is generally incomprehensibly loved and saw. Check this for getting wonderful ideas. I'm utilizing it for a fundamental long time now.
Ahmed74 · 9 weeks and 2 days ago
I have chosen to help Woodlands for this condition since these individuals are doing so well for the improvement of creatures. Click website for getting wonderful details. I would redirect into a working individual from their Buy A Bale crusade.
Ahmed74 · 9 weeks and 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: